Rudiments
|
Inherits listcollection< valuetype >.
Public Member Functions | |
singlylinkedlist () | |
singlylinkedlist (singlylinkedlist< valuetype > &a) | |
singlylinkedlist (listcollection< valuetype > &a) | |
singlylinkedlist< valuetype > & | operator= (singlylinkedlist< valuetype > &a) |
singlylinkedlist< valuetype > & | operator= (nodecollection< valuetype > &a) |
~singlylinkedlist () | |
void | prepend (valuetype value) |
void | prepend (listnode< valuetype > *node) |
void | append (valuetype value) |
void | append (listnode< valuetype > *node) |
void | insertAfter (listnode< valuetype > *node, valuetype value) |
void | insertAfter (listnode< valuetype > *node, listnode< valuetype > *newnode) |
void | moveAfter (listnode< valuetype > *node, listnode< valuetype > *nodetomove) |
void | detach (listnode< valuetype > *node) |
bool | remove (valuetype value) |
bool | removeAll (valuetype value) |
bool | remove (listnode< valuetype > *node) |
uint64_t | getCount () |
listnode< valuetype > * | getFirst () |
listnode< valuetype > * | getLast () |
listnode< valuetype > * | getNext (listnode< valuetype > *node) |
listnode< valuetype > * | find (valuetype value) |
listnode< valuetype > * | find (listnode< valuetype > *startnode, valuetype value) |
void | sortInexpensively () |
void | sortQuickly () |
bool | clear () |
Public Member Functions inherited from listcollection< valuetype > | |
listcollection () | |
listcollection (nodecollection< valuetype > &n) | |
virtual const char * | getType () |
virtual void | prepend (valuetype *values, uint64_t count) |
virtual void | append (valuetype *values, uint64_t count) |
virtual void | insertBefore (listnode< valuetype > *node, valuetype value)=0 |
virtual void | insertBefore (listnode< valuetype > *node, valuetype *values, uint64_t count) |
virtual void | insertBefore (listnode< valuetype > *node, listnode< valuetype > *newnode)=0 |
virtual void | insertAfter (listnode< valuetype > *node, valuetype *values, uint64_t count) |
virtual void | moveBefore (listnode< valuetype > *node, listnode< valuetype > *nodetomove)=0 |
virtual ssize_t | write () |
virtual ssize_t | write (output *out) |
virtual ssize_t | writeJson () |
virtual ssize_t | writeJson (bool indent) |
virtual ssize_t | writeJson (output *out) |
virtual ssize_t | writeJson (output *out, bool indent) |
Public Member Functions inherited from collection | |
collection () | |
collection (collection &c) | |
collection & | operator= (collection &c) |
virtual | ~collection () |
comparator * | getComparator () |
void | setComparator (comparator *newcomp) |
virtual bool | isReadOnly () |
virtual bool | isBlockBased () |
virtual uint64_t | getBlockSize () |
virtual bool | isSequentialAccess () |
virtual void | setManageValues (bool manage) |
virtual bool | getManageValues () |
virtual void | setManageArrayValues (bool manage) |
virtual bool | getManageArrayValues () |
virtual void | setManageKeys (bool manage) |
virtual bool | getManageKeys () |
virtual void | setManageArrayKeys (bool manage) |
virtual bool | getManageArrayKeys () |
Public Member Functions inherited from object | |
virtual | ~object () |
The singlylinkedlist class allows you to store an arbitrary number of values in a singly-linked list. Since the singlylinkedlist class is template-based, you can store arbitrary types of values.
Each singlylinkedlist is composed of a series of singlylinkedlistnodes. Each singlylinkedlistnode contains a value.
This class is similar to the linkedlist class but uses less memory and many of its operations are faster.
However, the move, detach and remove operations are much slower. If your application must run these operations regularly, you should consider using the linkedlist class instead.
|
inline |
Creates an empty instance of the singlylinkedlist class.
|
inline |
Creates an instance of the singlylinkedlist class that is a copy of "a".
|
inline |
Creates an instance of the singlylinkedlist class that is a copy of "a".
|
inline |
Deletes this instance of the singlylinkedlist class and all of its singlylinkedlistnodes.
The value stored in each singlylinkedlistnode is only deleted if setManageValues(true) or setManageArrayValues(true) has been called.
|
inlinevirtual |
Appends already created singlylinkedlistnode "node" to the singlylinkedlist.
Implements listcollection< valuetype >.
|
inlinevirtual |
Creates a new singlylinkedlistnode containing "value" and appends it to the singlylinkedlist.
Implements listcollection< valuetype >.
|
inlinevirtual |
Deletes all singlylinkedlistnodes currently in the singlylinkedlist.
The value stored in each singlylinkedlistnode is only deleted if setManageValues(true) or setManageArrayValues(true) has been called.
Always returns true.
Implements collection.
|
inlinevirtual |
Detaches "node" from the list.
Note that this operation requires a search and is expensive in both execution time and code size. Consider using the linkedlist class.
Implements listcollection< valuetype >.
|
inlinevirtual |
Returns a pointer to the first singlylinkedlistnode after "startnode" containing "value" or NULL if "value" was not found.
Implements listcollection< valuetype >.
|
inlinevirtual |
Returns a pointer to the first singlylinkedlistnode containing "value" or NULL if "value" was not found.
Implements listcollection< valuetype >.
|
inlinevirtual |
Returns the number of nodes in the singlylinkedlist.
Implements collection.
|
inlinevirtual |
Returns the first node in the singlylinkedlist.
Implements listcollection< valuetype >.
|
inline |
Returns the last node in the singlylinkedlist.
|
inlinevirtual |
Returns the node after "node" or NULL if this node is the last node in the list. "node" is presumed to be in the list.
Implements listcollection< valuetype >.
|
inlinevirtual |
Inserts already created singlylinkedlistnode "node" into the singlylinkedlist after "node".
Implements listcollection< valuetype >.
|
inlinevirtual |
Creates a new singlylinkedlistnode containing "value" and inserts it into the singlylinkedlist after "node".
Implements listcollection< valuetype >.
|
inlinevirtual |
Moves node "nodetomove" to the position after "node" in the singlylinkedlist.
Note that this operation requires a search and is expensive in both execution time and code size. Consider using the linkedlist class.
Implements listcollection< valuetype >.
|
inline |
Makes this instance of the singlylinkedlist class identical to "a".
|
inline |
Makes this instance of the singlylinkedlist class identical to "a".
|
inlinevirtual |
Prepends already created singlylinkedlistnode "node" to the singlylinkedlist.
Implements listcollection< valuetype >.
|
inlinevirtual |
Creates a new singlylinkedlistnode containing "value" and prepends it to the singlylinkedlist.
Implements listcollection< valuetype >.
|
inlinevirtual |
Removes singlylinkedlistnode "node" from the singlylinkedlist.
The value stored in the singlylinkedlistnode is only deleted if setManageValues(true) or setManageArrayValues(true) has been called.
Note that this operation requires a search and is expensive in both execution time and code size. Consider using the linkedlist class.
Returns true on success and false on failure.
Implements listcollection< valuetype >.
|
inlinevirtual |
Deletes the first singlylinkedlistnode containing "value".
The value stored in the singlylinkedlistnode is only deleted if setManageValues(true) or setManageArrayValues(true) has been called.
Note that this operation requires a search and is expensive in both execution time and code size. Consider using the linkedlist class.
Returns true on success and false on failure.
Implements listcollection< valuetype >.
|
inlinevirtual |
Deletes all singlylinkedlistnodes containing "value".
The value stored in each singlylinkedlistnode is only deleted if setManageValues(true) or setManageArrayValues(true) has been called.
Note that this operation requires a search and is expensive in both execution time and code size. Consider using the linkedlist class.
Returns true on success and false on failure.
Implements listcollection< valuetype >.
|
inlinevirtual |
Sorts the listcollection.
This sort is potentially much slower than sortQuickly() but uses no additional memory.
The order that the items are sorted into depends on the comparator that is being used, and how that comparator is configured. The default comparator, in its default configuration causes the list to be sorted in ascending order.
See collection::setComparator() and the comparator class for more detail.
Implements listcollection< valuetype >.
|
inlinevirtual |
Sorts the listcollection.
This sort is potentially much faster than sortInexpensively() but uses additional memory in proportion to the size of the list.
The order that the items are sorted into depends on the comparator that is being used, and how that comparator is configured. The default comparator, in its default configuration causes the list to be sorted in ascending order.
See collection::setComparator() and the comparator class for more detail.
Implements listcollection< valuetype >.