Rudiments
Public Member Functions | List of all members
listcollection< valuetype > Class Template Referenceabstract

#include <listcollection.h>

Inherits nodecollection< valuetype >.

Inherited by linkedlist< valuetype >, and singlylinkedlist< valuetype >.

Public Member Functions

 listcollection ()
 
 listcollection (nodecollection< valuetype > &n)
 
virtual const chargetType ()
 
virtual void prepend (valuetype value)=0
 
virtual void prepend (valuetype *values, uint64_t count)
 
virtual void prepend (listnode< valuetype > *node)=0
 
virtual void append (valuetype value)=0
 
virtual void append (valuetype *values, uint64_t count)
 
virtual void append (listnode< valuetype > *node)=0
 
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 value)=0
 
virtual void insertAfter (listnode< valuetype > *node, valuetype *values, uint64_t count)
 
virtual void insertAfter (listnode< valuetype > *node, listnode< valuetype > *newnode)=0
 
virtual void moveBefore (listnode< valuetype > *node, listnode< valuetype > *nodetomove)=0
 
virtual void moveAfter (listnode< valuetype > *node, listnode< valuetype > *nodetomove)=0
 
virtual void detach (listnode< valuetype > *node)=0
 
virtual bool remove (valuetype value)=0
 
virtual bool removeAll (valuetype value)=0
 
virtual bool remove (listnode< valuetype > *node)=0
 
virtual listnode< valuetype > * getFirst ()=0
 
virtual listnode< valuetype > * getNext (listnode< valuetype > *node)=0
 
virtual listnode< valuetype > * find (valuetype value)=0
 
virtual listnode< valuetype > * find (listnode< valuetype > *startnode, valuetype value)=0
 
virtual void sortInexpensively ()=0
 
virtual void sortQuickly ()=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)
 
collectionoperator= (collection &c)
 
virtual ~collection ()
 
virtual uint64_t getCount ()=0
 
comparatorgetComparator ()
 
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 ()
 
virtual bool clear ()=0
 
- Public Member Functions inherited from object
virtual ~object ()
 

Detailed Description

template<class valuetype>
class listcollection< valuetype >

The listcollection class is the parent class for all rudiments list collections.

Constructor & Destructor Documentation

◆ listcollection() [1/2]

Creates an empty instance of the listcollection class.

◆ listcollection() [2/2]

Creates an instance of the listcollection class that is a copy of "a".

Member Function Documentation

◆ append() [1/3]

template<class valuetype >
virtual void listcollection< valuetype >::append ( listnode< valuetype > * node)
pure virtual

Appends already created listnode "node" to the listcollection.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ append() [2/3]

template<class valuetype >
void listcollection< valuetype >::append ( valuetype * values,
uint64_t count )
inlinevirtual

Creates new listnodes containing "count" members of array "value" and appends them to the listcollection.

◆ append() [3/3]

template<class valuetype >
virtual void listcollection< valuetype >::append ( valuetype value)
pure virtual

Creates a new listnode containing "value" and appends it to the listcollection.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ detach()

template<class valuetype >
virtual void listcollection< valuetype >::detach ( listnode< valuetype > * node)
pure virtual

Detaches "node" from the list.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ find() [1/2]

template<class valuetype >
virtual listnode< valuetype > * listcollection< valuetype >::find ( listnode< valuetype > * startnode,
valuetype value )
pure virtual

Returns a pointer to the first listnode after "startnode" containing "value" or NULL if "value" was not found.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ find() [2/2]

template<class valuetype >
virtual listnode< valuetype > * listcollection< valuetype >::find ( valuetype value)
pure virtual

Returns a pointer to the first listnode containing "value" or NULL if "value" was not found.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ getFirst()

template<class valuetype >
virtual listnode< valuetype > * listcollection< valuetype >::getFirst ( )
pure virtual

Returns the first node in the listcollection.

Implements nodecollection< valuetype >.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ getNext()

template<class valuetype >
virtual listnode< valuetype > * listcollection< valuetype >::getNext ( listnode< valuetype > * node)
pure virtual

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.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ getType()

template<class valuetype >
const char * listcollection< valuetype >::getType ( )
inlinevirtual

Returns "list".

Implements collection.

◆ insertAfter() [1/3]

template<class valuetype >
virtual void listcollection< valuetype >::insertAfter ( listnode< valuetype > * node,
listnode< valuetype > * newnode )
pure virtual

Inserts already created listnode "newnode" into the listcollection after "node".

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ insertAfter() [2/3]

template<class valuetype >
void listcollection< valuetype >::insertAfter ( listnode< valuetype > * node,
valuetype * values,
uint64_t count )
inlinevirtual

Creates new listnodes containing "count" members of array "value" and inserts them into the listcollection after "node".

◆ insertAfter() [3/3]

template<class valuetype >
virtual void listcollection< valuetype >::insertAfter ( listnode< valuetype > * node,
valuetype value )
pure virtual

Creates a new listnode containing "value" and inserts it into the listcollection after "node".

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ insertBefore() [1/3]

template<class valuetype >
virtual void listcollection< valuetype >::insertBefore ( listnode< valuetype > * node,
listnode< valuetype > * newnode )
pure virtual

Inserts already created listnode "newnode" into the listcollection before "node".

Implemented in linkedlist< valuetype >.

◆ insertBefore() [2/3]

template<class valuetype >
void listcollection< valuetype >::insertBefore ( listnode< valuetype > * node,
valuetype * values,
uint64_t count )
inlinevirtual

Creates new listnodes containing "count" members of array "value" and inserts them into the listcollection before "node".

◆ insertBefore() [3/3]

template<class valuetype >
virtual void listcollection< valuetype >::insertBefore ( listnode< valuetype > * node,
valuetype value )
pure virtual

Creates a new listnode containing "value" and inserts it into the listcollection before "node".

Implemented in linkedlist< valuetype >.

◆ moveAfter()

template<class valuetype >
virtual void listcollection< valuetype >::moveAfter ( listnode< valuetype > * node,
listnode< valuetype > * nodetomove )
pure virtual

Moves node "nodetomove" to the position after "node" in the listcollection.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ moveBefore()

template<class valuetype >
virtual void listcollection< valuetype >::moveBefore ( listnode< valuetype > * node,
listnode< valuetype > * nodetomove )
pure virtual

Moves node "nodetomove" to the position before "node" in the listcollection.

Implemented in linkedlist< valuetype >.

◆ prepend() [1/3]

template<class valuetype >
virtual void listcollection< valuetype >::prepend ( listnode< valuetype > * node)
pure virtual

Prepends already created listnode "node" to the listcollection.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ prepend() [2/3]

template<class valuetype >
void listcollection< valuetype >::prepend ( valuetype * values,
uint64_t count )
inlinevirtual

Creates new listnodes containing "count" members of array "value" and prepends them to the listcollection.

◆ prepend() [3/3]

template<class valuetype >
virtual void listcollection< valuetype >::prepend ( valuetype value)
pure virtual

Creates a new listnode containing "value" and prepends it to the listcollection.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ remove() [1/2]

template<class valuetype >
virtual bool listcollection< valuetype >::remove ( listnode< valuetype > * node)
pure virtual

Removes listnode "node" from the listcollection.

The value stored in the listnode is only deleted if setManageValues(true) or setManageArrayValues(true) has been called.

Note that this operation does not require a search and is far less expensive than the remove(value) operation and removeAll().

Returns true on success and false on failure.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ remove() [2/2]

template<class valuetype >
virtual bool listcollection< valuetype >::remove ( valuetype value)
pure virtual

Deletes the first listnode containing "value".

The value stored in the listnode 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.

Returns true on success and false on failure.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ removeAll()

template<class valuetype >
virtual bool listcollection< valuetype >::removeAll ( valuetype value)
pure virtual

Deletes all listnodes containing "value".

The value stored in each listnode 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.

Returns true on success and false on failure.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ sortInexpensively()

template<class valuetype >
virtual void listcollection< valuetype >::sortInexpensively ( )
pure virtual

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.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ sortQuickly()

template<class valuetype >
virtual void listcollection< valuetype >::sortQuickly ( )
pure virtual

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.

Implemented in linkedlist< valuetype >, and singlylinkedlist< valuetype >.

◆ write() [1/2]

template<class valuetype >
ssize_t listcollection< valuetype >::write ( )
inlinevirtual

Writes a representation of the listcollection to standard output.

Implements collection.

◆ write() [2/2]

template<class valuetype >
ssize_t listcollection< valuetype >::write ( output * out)
inlinevirtual

Writes a representation of the listcollection to "out".

Implements collection.

◆ writeJson() [1/4]

template<class valuetype >
ssize_t listcollection< valuetype >::writeJson ( )
inlinevirtual

Writes a JSON representation of the listcollection to standard output.

Implements collection.

◆ writeJson() [2/4]

template<class valuetype >
ssize_t listcollection< valuetype >::writeJson ( bool indent)
inlinevirtual

Writes a JSON representation of the listcollection to standard output.

If "indent" is true, then the output is automatically indented. If "indent" is false, then the tree is written without indentation.

Implements collection.

◆ writeJson() [3/4]

template<class valuetype >
ssize_t listcollection< valuetype >::writeJson ( output * out)
inlinevirtual

Writes a JSON representation of the listcollection to "out".

Implements collection.

◆ writeJson() [4/4]

template<class valuetype >
ssize_t listcollection< valuetype >::writeJson ( output * out,
bool indent )
inlinevirtual

Writes a JSON representation of the listcollection to "out".

If "indent" is true, then the output is automatically indented. If "indent" is false, then the tree is written without indentation.

Implements collection.