Oracle® Coherence Java API Reference
v3.5.3

E15583-01

com.tangosol.util
Class AbstractSparseArray.Node

java.lang.Object
  extended by com.tangosol.util.AbstractSparseArray.Node
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
PrimitiveSparseArray.PrimitiveNode, SparseArray.ObjectNode
Enclosing class:
AbstractSparseArray

protected abstract static class AbstractSparseArray.Node
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

An AVL tree node. This class is used only within the AbstractSparseArray class and its derivations.


Field Summary
protected  int balance
          The AVL balance factor of the sub-tree.
protected  long key
          The key of the node.
protected  AbstractSparseArray.Node left
          The left child of this node.
protected  AbstractSparseArray.Node parent
          The parent of this node.
protected  AbstractSparseArray.Node right
          The right child of this node.
 
Constructor Summary
protected AbstractSparseArray.Node()
           
 
Method Summary
protected  void adopt(AbstractSparseArray.Node child, boolean fLeft)
          Adopt a child node
 java.lang.Object clone()
          Make a shallow copy of the node and its sub-nodes.
abstract  java.lang.Object 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.
protected  boolean isLinked()
          Return true iff the node is linked to other nodes.
protected  void print()
          Print the tree structure.
abstract  java.lang.Object setValue(java.lang.Object oValue)
          Set the value associated with the node.
 java.lang.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.
 

Field Detail

key

protected long key
The key of the node. The key, once set, is considered immutable.


parent

protected AbstractSparseArray.Node parent
The parent of this node.


left

protected AbstractSparseArray.Node left
The left child of this node.


right

protected AbstractSparseArray.Node right
The right child of this node.


balance

protected int balance
The AVL balance factor of the sub-tree.

Constructor Detail

AbstractSparseArray.Node

protected AbstractSparseArray.Node()
Method Detail

adopt

protected void adopt(AbstractSparseArray.Node child,
                     boolean fLeft)
Adopt a child node

Parameters:
child - the child to adopt
fLeft - the position of the child

getValue

public abstract java.lang.Object getValue()
Get the value associated with the node.

Returns:
the value associated with the node.

setValue

public abstract java.lang.Object setValue(java.lang.Object oValue)
Set the value associated with the node.

Parameters:
oValue - the value assocaited with the node
Returns:
the old value associated with the node

toString

public java.lang.String toString()
Provide a string representation of this node's value.


clone

public java.lang.Object 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

Oracle® Coherence Java API Reference
v3.5.3

E15583-01

Copyright © 2000, 2010, Oracle. All rights reserved.