container.linkedlist - Palamecia/mint GitHub Wiki
Module
load container.linkedlist
This module provides the Container.LinkedList class which store objects with a constant insertion or removal time.
Packages
Classes
Container.LinkedList
This class creates a linked list which stores a liste of values and provides an iterator-based access as well as constant time insertions and removals.
For most purposes, Container.List is the is the right class to use. If you need a real linked list, with guarantees of constant time insertions in the middle of the list and iterators to items rather than indexes, use Container.LinkedList.
Public members
Modifiers | Member | Description |
---|---|---|
class |
Node | This class store the context of a node of a Container.LinkedList. It can be r... |
const |
append | Inserts value at the end of the list. |
const |
clear | Removes all the elements of the list. |
const |
contains | Returns true if the list contains value ; otherwise returns false . |
const |
count | Returns the number of occurrences of value in the list. |
const |
data | Returns an array containing each elements of the list. |
const |
delete | Cleans up the list instance. |
const |
each | Apply the func function to each elements of the list. |
const |
first | Returns the first element of the list. If the list is empty, none is return... |
const |
firstNode | Returns the first node of the list. If the list is empty, none is returned. |
const |
in | Returns an iterator on the elements of the list. |
const |
insertAfter | Inserts a new node storing the given value after the given node . |
const |
insertBefore | Inserts a new node storing the given value before the given node . |
const |
isEmpty | Returns true if the list is empty; otherwise returns false . |
const |
last | Returns the last element of the list. If the list is empty, none is returned. |
const |
lastNode | Returns the last node of the list. If the list is empty, none is returned. |
const |
moveAfter | Moves the from node after the to node. |
const |
moveBefore | Moves the from node before the to node. |
const |
new | Creates a new instance of Container.LinkedList. If values is given, the lis... |
const |
nodeOf | Returns the node of the first occurrence of value in the list, searching fo... |
const |
prepend | Inserts value at the beginning of the list. |
const |
remove | Removes the node element of the list and returns the next node. |
const |
removeAll | Removes all the occurences of value in the list. |
const |
removeFirst | Removes the first element of the list. |
const |
removeLast | Removes the last element of the list. |
const |
removeOne | Removes the first occurence of value in the list. |
const |
replace | Replaces the node with a new node storing the given value . |
const |
size | Returns the number of elements in the list. |
const |
toArray | Converts the list to an array . |
Private members
Modifiers | Member | Description |
---|---|---|
class |
Data | Internal root element data structure. |
final |
root | Root element data. |
Container.LinkedList.Data
Internal root element data structure.
Public members
Modifiers | Member | Description |
---|---|---|
back | Last element of the list. | |
front | First element of the list. |
Container.LinkedList.Node
This class store the context of a node of a Container.LinkedList. It can be retrieved with Container.LinkedList.firstNode or Container.LinkedList.lastNode.
Public members
Modifiers | Member | Description |
---|---|---|
const |
getNext | Returns the next node. If self is the last node, none is returned. |
const |
getPrevious | Returns the previous node. If self is the first node, none is returned. |
const |
getValue | Returns the value of the node. |
const |
insertNext | Inserts a next node. |
const |
insertPrevious | Inserts a previous node. |
const |
new | Creates a new node storing value into the list context. |
const |
remove | Removes the node. |
const |
replace | Replaces the node. |
Private members
Modifiers | Member | Description |
---|---|---|
final |
list | List element data |
final |
next | Next node in the list |
final |
prev | Previous node in the list |
final |
value | Node value |
Descriptions
Container.LinkedList.Data.back
null
Last element of the list.
Container.LinkedList.Data.front
null
First element of the list.
Container.LinkedList.Node.getNext
def (const self)
Returns the next node. If self
is the last node, none
is
returned.
Container.LinkedList.Node.getPrevious
def (const self)
Returns the previous node. If self
is the first node, none
is
returned.
Container.LinkedList.Node.getValue
def (const self)
Returns the value of the node.
Container.LinkedList.Node.insertNext
def (self, node)
Inserts a next node.
Container.LinkedList.Node.insertPrevious
def (self, node)
Inserts a previous node.
Container.LinkedList.Node.list
null
List element data
Container.LinkedList.Node.new
def (self, list, value)
Creates a new node storing value
into the list
context.
Container.LinkedList.Node.next
null
Next node in the list
Container.LinkedList.Node.prev
null
Previous node in the list
Container.LinkedList.Node.remove
def (self)
Removes the node.
Container.LinkedList.Node.replace
def (self, node)
Replaces the node.
Container.LinkedList.Node.value
none
Node value
Container.LinkedList.append
def (self, value)
Inserts value
at the end of the list.
Container.LinkedList.clear
def (self)
Removes all the elements of the list.
Container.LinkedList.contains
def (const self, value)
Returns true
if the list contains value
; otherwise returns false
.
Container.LinkedList.count
def (const self, value)
Returns the number of occurrences of value
in the list.
Container.LinkedList.data
def (const self)
Returns an array
containing each elements of the list.
Container.LinkedList.delete
def (self)
Cleans up the list instance.
Container.LinkedList.each
def (const self, func)
Apply the func
function to each elements of the list.
Container.LinkedList.first
def (const self)
Returns the first element of the list. If the list is empty, none
is
returned.
Container.LinkedList.firstNode
def (const self)
Returns the first node of the list. If the list is empty, none
is
returned.
Container.LinkedList.in
def (const self)
Returns an iterator
on the elements of the list.
def (const self, const value)
Returns true
if the list contains value
; otherwise returns false
.
Container.LinkedList.insertAfter
def (self, node, value)
Inserts a new node storing the given value
after the given node
.
Container.LinkedList.insertBefore
def (self, node, value)
Inserts a new node storing the given value
before the given node
.
Container.LinkedList.isEmpty
def (const self)
Returns true
if the list is empty; otherwise returns false
.
Container.LinkedList.last
def (const self)
Returns the last element of the list. If the list is empty, none
is
returned.
Container.LinkedList.lastNode
def (const self)
Returns the last node of the list. If the list is empty, none
is
returned.
Container.LinkedList.moveAfter
def (self, from, to)
Moves the from
node after the to
node.
Container.LinkedList.moveBefore
def (self, from, to)
Moves the from
node before the to
node.
Container.LinkedList.new
def (self, values = [])
Creates a new instance of Container.LinkedList. If values
is given,
the list will be initialized with the given values.
Container.LinkedList.nodeOf
def (const self, value, from = none)
Returns the node of the first occurrence of value
in the list,
searching forward from node from
if given or from the list beginning.
Returns none
if no element matched.
Container.LinkedList.prepend
def (self, value)
Inserts value
at the beginning of the list.
Container.LinkedList.remove
def (self, node)
Removes the node
element of the list and returns the next node.
Container.LinkedList.removeAll
def (self, value)
Removes all the occurences of value
in the list.
Container.LinkedList.removeFirst
def (self)
Removes the first element of the list.
Container.LinkedList.removeLast
def (self)
Removes the last element of the list.
Container.LinkedList.removeOne
def (self, value)
Removes the first occurence of value
in the list.
Container.LinkedList.replace
def (self, node, value)
Replaces the node
with a new node storing the given value
.
Container.LinkedList.root
null
Root element data.
Container.LinkedList.size
def (const self)
Returns the number of elements in the list.
Container.LinkedList.toArray
def (const self)
Converts the list to an array
.