Package com.tangosol.util
Class AbstractSparseArray.Node<V>
java.lang.Object
com.tangosol.util.AbstractSparseArray.Node<V>
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
PrimitiveSparseArray.PrimitiveNode
,SparseArray.ObjectNode
- Enclosing class:
AbstractSparseArray<V>
protected abstract static class AbstractSparseArray.Node<V>
extends Object
implements Cloneable, Serializable
An AVL tree node. This class is used only within the AbstractSparseArray
class and its derivations.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
The AVL balance factor of the sub-tree.protected long
The key of the node.protected AbstractSparseArray.Node
<V> The left child of this node.protected AbstractSparseArray.Node
<V> The parent of this node.protected AbstractSparseArray.Node
<V> The right child of this node. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
adopt
(AbstractSparseArray.Node<V> child, boolean fLeft) Adopt a child nodeclone()
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
Set the value associated with the node.toString()
Provide a string representation of this node's value.protected int
validate()
Validate the tree rooted at node is a proper AVL tree.
-
Field Details
-
key
protected long keyThe key of the node. The key, once set, is considered immutable. -
parent
The parent of this node. -
left
The left child of this node. -
right
The right child of this node. -
balance
protected int balanceThe AVL balance factor of the sub-tree.
-
-
Constructor Details
-
Node
protected Node()
-
-
Method Details
-
adopt
Adopt a child node- Parameters:
child
- the child to adoptfLeft
- the position of the child
-
getValue
Get the value associated with the node.- Returns:
- the value associated with the node.
-
setValue
Set the value associated with the node.- Parameters:
oValue
- the value associated with the node- Returns:
- the old value associated with the node
-
toString
Provide a string representation of this node's value. -
clone
Make a shallow copy of the node and its sub-nodes. -
isLeaf
protected boolean isLeaf()Determine if this node is a part of a 2-3-4 leaf node (i.e. at least one null child).- Returns:
- true if this node is a leaf
-
isLinked
protected boolean isLinked()Return true iff the node is linked to other nodes.- Returns:
- true iff the node has a parent or children
-
print
protected void print()Print the tree structure. -
validate
protected int validate()Validate the tree rooted at node is a proper AVL tree.- Returns:
- the height of the node within the tree
-