-
Notifications
You must be signed in to change notification settings - Fork 2
container.linkedlist
load container.linkedlist
This module provides the Container.LinkedList class which store objects with a constant insertion or removal time.
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.
Modifiers | Member | Description |
---|---|---|
- class
|
Data | Internal root element data structure. |
+ 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 . |
- final
|
root | Root element data. |
+ const
|
size | Returns the number of elements in the list. |
+ const
|
toArray | Converts the list to an array . |
Internal root element data structure.
Modifiers | Member | Description |
---|---|---|
+ |
back | Last element of the list. |
+ |
front | First element of the list. |
This class store the context of a node of a Container.LinkedList. It can be retrieved with Container.LinkedList.firstNode or Container.LinkedList.lastNode.
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. |
- final
|
list | List element data |
+ const
|
new | Creates a new node storing value into the list context. |
- final
|
next | Next node in the list |
- final
|
prev | Previous node in the list |
+ const
|
remove | Removes the node. |
+ const
|
replace | Replaces the node. |
- final
|
value | Node value |
null
Last element of the list.
null
First element of the list.
def (const self)
Returns the next node. If self
is the last node, none
is
returned.
def (const self)
Returns the previous node. If self
is the first node, none
is
returned.
def (const self)
Returns the value of the node.
def (self, node)
Inserts a next node.
def (self, node)
Inserts a previous node.
null
List element data
def (self, list, value)
Creates a new node storing value
into the list
context.
null
Next node in the list
null
Previous node in the list
def (self)
Removes the node.
def (self, node)
Replaces the node.
none
Node value
def (self, value)
Inserts value
at the end of the list.
def (self)
Removes all the elements of the list.
def (const self, value)
Returns true
if the list contains value
; otherwise returns false
.
def (const self, value)
Returns the number of occurrences of value
in the list.
def (const self)
Returns an array
containing each elements of the list.
def (self)
Cleans up the list instance.
def (const self, func)
Apply the func
function to each elements of the list.
def (const self)
Returns the first element of the list. If the list is empty, none
is
returned.
def (const self)
Returns the first node of the list. If the list is empty, none
is
returned.
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
.
def (self, node, value)
Inserts a new node storing the given value
after the given node
.
def (self, node, value)
Inserts a new node storing the given value
before the given node
.
def (const self)
Returns true
if the list is empty; otherwise returns false
.
def (const self)
Returns the last element of the list. If the list is empty, none
is
returned.
def (const self)
Returns the last node of the list. If the list is empty, none
is
returned.
def (self, from, to)
Moves the from
node after the to
node.
def (self, from, to)
Moves the from
node before the to
node.
def (self, values = [])
Creates a new instance of Container.LinkedList. If values
is given,
the list will be initialized with the given values.
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.
def (self, value)
Inserts value
at the beginning of the list.
def (self, node)
Removes the node
element of the list and returns the next node.
def (self, value)
Removes all the occurences of value
in the list.
def (self)
Removes the first element of the list.
def (self)
Removes the last element of the list.
def (self, value)
Removes the first occurence of value
in the list.
def (self, node, value)
Replaces the node
with a new node storing the given value
.
null
Root element data.
def (const self)
Returns the number of elements in the list.
def (const self)
Converts the list to an array
.
Language reference
- Introduction
- Variables
- Built-in types
- Arithmetic operations
- Type casting
- Control structures
- Function definition
- User defined types
- Work with modules
Library reference