Constructor can be built upon on classes that extend this abstract class.
Default function only checks key validity of number, string, and Date. This function also only uses '===' for the comparison. Supply a custom function in the constructor to use properly with your data types.
Default function only checks value equality of number, string, and Date. THis function also only uses '===' for the comparison. Supply a custom function in the constructor to use properly with your data types.
Default function compares only number and string other wise the user will need to supply a custom key comparison function to use this Node Tree model properly.
Default function compares only number and string otherwise the use will need to supply a custom value comparison function to use this Node Tree model properly.
The key used to find this Node
Holds a child of this Node type if given
Holds the parent of this Node type if it exists
Holds a child of this Node type if given
set in the constructor to have only unique keys
The value this Node holds
Compare all keys, if there is no key then node fails then tree fails validation check. keys have to be of the same type.
Make sure this Node is referenced in children correctly and check all sub Nodes.
Used to check entire tree structure and individual branches to validate pointers.
Check all nodes and use compare keys function to validate Node and children of this Node.
Execute a function on every node of the tree, in key order
Check if this.key passes the equality check. A positive match will return false and a negative match will return true.
Base method used in high method to compare keys of two Nodes.
Example query: { $gt: 3 } or { $gte: 5 }
Returns the key of the max descendant
Recursively call for right child till there is none then return this.
Returns the key of the min descendant
Recursively call for left child till there is none then return this.
Count every key in branch or entire tree.
Returns binary tree as an array of arrays. Example: Inserting 0 - 4 keys in AVL tree would return this example with this method. inserts them as they would be seen in the binary tree 1 / \ 0 3 / \ / \ null null 2 4
[ [ { key: 1, value: [Object] }], [{key: 0, value: [Object]},{key: 3, value: [Object]}], [ null, null, {key: 2, value: [Object]}, {key: 4, value: [Object]}] ]
Retrieve the height at this current Node location
Base method used in high method to compare keys of two Nodes.
Example usage: { $lt: 3 } or { $lte: 4 }
Method for retrieving values based on key comparison of gt & lt & ne
Example: { $gt: 1 , $lte: 3, $ne: 2 }
To return this class and not the extended version use this method.
Turn tree into JSON with an array of objects holding the key and value Requires that key and value can be turned into JSON
Generated using TypeDoc
Abstract class used as template for high level tree classes.