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

Inherits nodecollection< valuetype >.

Inherited by avltree< valuetype >.

Public Member Functions

 treecollection ()
 
 treecollection (nodecollection< valuetype > &n)
 
virtual const char * getType ()
 
virtual void insert (valuetype value)=0
 
virtual void insert (valuetype *value, uint64_t count)
 
virtual void insert (treenode< valuetype > *node)=0
 
virtual treenode< valuetype > * detach (treenode< valuetype > *node)=0
 
virtual bool remove (valuetype value)=0
 
virtual bool removeAll (valuetype value)=0
 
virtual bool remove (treenode< valuetype > *node)=0
 
virtual treenode< valuetype > * getTop ()=0
 
virtual treenode< valuetype > * getFirst ()=0
 
virtual treenode< valuetype > * getLast ()=0
 
virtual treenode< valuetype > * getPrevious (treenode< valuetype > *node)=0
 
virtual treenode< valuetype > * getNext (treenode< valuetype > *node)=0
 
virtual treenode< valuetype > * find (valuetype value)=0
 
virtual treenode< valuetype > * find (treenode< valuetype > *startnode, valuetype value)=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)
 
virtual ssize_t writeXml ()
 
virtual ssize_t writeXml (bool indent)
 
virtual ssize_t writeXml (output *out)
 
virtual ssize_t writeXml (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 treecollection< valuetype >

The treecollection class is the parent class for all rudiments tree collections.

Constructor & Destructor Documentation

◆ treecollection() [1/2]

template<class valuetype >
treecollection< valuetype >::treecollection
inline

Creates an empty instance of the treecollection class.

◆ treecollection() [2/2]

template<class valuetype >
treecollection< valuetype >::treecollection ( nodecollection< valuetype > &  n)
inline

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

Member Function Documentation

◆ detach()

template<class valuetype >
virtual treenode<valuetype>* treecollection< valuetype >::detach ( treenode< valuetype > *  node)
pure virtual

Detaches "node" from the tree.

Implemented in avltree< valuetype >.

◆ find() [1/2]

template<class valuetype >
virtual treenode<valuetype>* treecollection< valuetype >::find ( treenode< valuetype > *  startnode,
valuetype  value 
)
pure virtual

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

Implemented in avltree< valuetype >.

◆ find() [2/2]

template<class valuetype >
virtual treenode<valuetype>* treecollection< valuetype >::find ( valuetype  value)
pure virtual

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

Implemented in avltree< valuetype >.

◆ getFirst()

template<class valuetype >
virtual treenode<valuetype>* treecollection< valuetype >::getFirst ( )
pure virtual

Returns the first node in the treecollection (in an in-order, depth-first traversal).

Implements nodecollection< valuetype >.

Implemented in avltree< valuetype >.

◆ getLast()

template<class valuetype >
virtual treenode<valuetype>* treecollection< valuetype >::getLast ( )
pure virtual

Returns the last node in the treecollection (in an in-order, depth-first traversal).

Implemented in avltree< valuetype >.

◆ getNext()

template<class valuetype >
virtual treenode<valuetype>* treecollection< valuetype >::getNext ( treenode< valuetype > *  node)
pure virtual

Returns the node after "node" or NULL if this node is the last node in the tree (in an in-order, depth-first traversal). "node" is presumed to be in the tree.

Implemented in avltree< valuetype >.

◆ getPrevious()

template<class valuetype >
virtual treenode<valuetype>* treecollection< valuetype >::getPrevious ( treenode< valuetype > *  node)
pure virtual

Returns the node prior to "node" or NULL if this node is the first node in the tree (in an in-order, depth-first traversal). "node" is presumed to be in the tree.

Implemented in avltree< valuetype >.

◆ getTop()

template<class valuetype >
virtual treenode<valuetype>* treecollection< valuetype >::getTop ( )
pure virtual

Returns the top-most node in the treecollection.

Implemented in avltree< valuetype >.

◆ getType()

template<class valuetype >
const char * treecollection< valuetype >::getType
inlinevirtual

Returns "tree".

Implements collection.

◆ insert() [1/3]

template<class valuetype >
virtual void treecollection< valuetype >::insert ( treenode< valuetype > *  node)
pure virtual

Inserts already created treenode "node" to the treecollection.

Implemented in avltree< valuetype >.

◆ insert() [2/3]

template<class valuetype >
void treecollection< valuetype >::insert ( valuetype *  value,
uint64_t  count 
)
inlinevirtual

Creates new treenodes containing "count" members of array "value" and inserts them into the treecollection.

◆ insert() [3/3]

template<class valuetype >
virtual void treecollection< valuetype >::insert ( valuetype  value)
pure virtual

Creates a new treenode containing "value" and prepends it to the avltree.

Implemented in avltree< valuetype >.

◆ remove() [1/2]

template<class valuetype >
virtual bool treecollection< valuetype >::remove ( treenode< valuetype > *  node)
pure virtual

Removed avltreenode "node" from the avltree.

The value stored in the avltreenode 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 avltree< valuetype >.

◆ remove() [2/2]

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

Deletes the first avltreenode containing "value".

The value stored in the avltreenode 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 avltree< valuetype >.

◆ removeAll()

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

Deletes all avltreenodes containing "value".

The value stored in each avltreenode 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 avltree< valuetype >.

◆ write() [1/2]

template<class valuetype >
ssize_t treecollection< valuetype >::write
inlinevirtual

Writes a representation of the treecollection to standard output.

Implements collection.

◆ write() [2/2]

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

Writes a representation of the treecollection to "out".

Implements collection.

◆ writeJson() [1/4]

template<class valuetype >
ssize_t treecollection< valuetype >::writeJson
inlinevirtual

Writes a JSON representation of the treecollection to standard output.

Implements collection.

◆ writeJson() [2/4]

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

Writes a JSON representation of the treecollection 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 treecollection< valuetype >::writeJson ( output out)
inlinevirtual

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

Implements collection.

◆ writeJson() [4/4]

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

Writes a JSON representation of the treecollection 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.

◆ writeXml() [1/4]

template<class valuetype >
ssize_t treecollection< valuetype >::writeXml
inlinevirtual

Writes an XML representation of the treecollection to standard output.

◆ writeXml() [2/4]

template<class valuetype >
ssize_t treecollection< valuetype >::writeXml ( bool  indent)
inlinevirtual

Writes an XML representation of the treecollection to standard output.

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

◆ writeXml() [3/4]

template<class valuetype >
ssize_t treecollection< valuetype >::writeXml ( output out)
inlinevirtual

Writes an XML representation of the treecollection to "out".

◆ writeXml() [4/4]

template<class valuetype >
ssize_t treecollection< valuetype >::writeXml ( output out,
bool  indent 
)
inlinevirtual

Writes an XML representation of the treecollection to "out".

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