protected abstract static class AbstractSparseArray.Node<V> extends Object implements Cloneable, Serializable
Modifier and Type | Field and Description |
---|---|
protected int |
balance
The AVL balance factor of the sub-tree.
|
protected long |
key
The key of the node.
|
protected AbstractSparseArray.Node<V> |
left
The left child of this node.
|
protected AbstractSparseArray.Node<V> |
parent
The parent of this node.
|
protected AbstractSparseArray.Node<V> |
right
The right child of this node.
|
Modifier | Constructor and Description |
---|---|
protected |
Node() |
Modifier and Type | Method and Description |
---|---|
protected void |
adopt(AbstractSparseArray.Node<V> child,
boolean fLeft)
Adopt a child node
|
AbstractSparseArray.Node<V> |
clone()
Make a shallow copy of the node and its sub-nodes.
|
abstract V |
getValue()
Get the value associated with the node.
|
protected boolean |
isLeaf()
Determine if this node is a part of a 2-3-4 leaf node
(i.e. at least one null child).
|
protected boolean |
isLinked()
Return true iff the node is linked to other nodes.
|
protected void |
print()
Print the tree structure.
|
abstract V |
setValue(V oValue)
Set the value associated with the node.
|
String |
toString()
Provide a string representation of this node's value.
|
protected int |
validate()
Validate the tree rooted at node is a proper AVL tree.
|
protected long key
protected AbstractSparseArray.Node<V> parent
protected AbstractSparseArray.Node<V> left
protected AbstractSparseArray.Node<V> right
protected int balance
protected void adopt(AbstractSparseArray.Node<V> child, boolean fLeft)
child
- the child to adoptfLeft
- the position of the childpublic abstract V getValue()
public abstract V setValue(V oValue)
oValue
- the value associated with the nodepublic String toString()
public AbstractSparseArray.Node<V> clone()
protected boolean isLeaf()
protected boolean isLinked()
protected void print()
protected int validate()