Constructor
(protected) new TreeNode(key, value, parent, leftChild, rightChild, endnode)
Create node of tree.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
key |
* |
null
|
the key of node for compare. Should not TreeNode. |
value |
* |
null
|
the value of node for save. |
parent |
TreeNode |
null
|
the parent of node in tree. |
leftChild |
TreeNode |
null
|
the left child of node in tree. |
rightChild |
TreeNode |
null
|
the right child of node in tree. |
endnode |
EndNode |
null
|
endnode of tree iterator. |
Methods
getKey() → {*}
Return the key of node.
Returns:
- the key of node.
- Type
- *
(protected) setKey()
getValue() → {*}
Return the value of node.
Returns:
- the value of node.
- Type
- *
(protected) setValue()
(protected) getColor() → {string}
Return the color of node.
Returns:
- the color of node.
- Type
- string
(protected) setColor()
(protected) getParent()
(protected) setParent()
(protected) getLeftChild()
(protected) setLeftChild()
(protected) getRightChild()
(protected) setRightChild()
getPrev() → {TreeNode}
Get prev node by the compare function.
At rendnode, it returns false.
Returns:
- the prev node.
- Type
- TreeNode
getNext() → {false|TreeNode}
Get next node by the compare function.
At endnode, it returns false.
Returns:
- the next node.
- Type
- false | TreeNode