CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.util
Class Tree.Crawler

java.lang.Object
  extended by com.tangosol.util.Tree.Crawler
All Implemented Interfaces:
Cloneable, Enumeration
Enclosing class:
Tree

protected static class Tree.Crawler
extends Object
implements Enumeration, Cloneable

A red/black tree node iterator. Simple concept:

  1. The node crawler knows what node it is on.
  2. The node crawler knows how it got there (from above, below left, from itself (it just returned this nodes value), or from below right)
  3. Using 1 and 2, the node crawler knows where to go next.
  4. The result of 3 is that at the next node (see 1) the crawler knows how it got there (see 2).
The methods of this local class are not synchronized; the enclosing class is responsible for synchronization.

Author:
Cameron Purdy

Field Summary
protected static int ABOVE
           
protected  Tree.Node current
           
protected  int fromdir
           
protected static int LEFT
           
protected static Tree.Node NIL
          NIL is the sentinal Node that is used instead of null, simplifying the implementation of the red/black tree.
protected static int RIGHT
           
protected static int SITTING
           
 
Constructor Summary
  Tree.Crawler(Tree.Node head)
          Crawler constructor.
protected Tree.Crawler(Tree.Node head, int fromdir)
          Crawler constructor.
 
Method Summary
 Object clone()
          Make a shallow copy of the node crawler.
 boolean hasMoreElements()
          Tests if this enumeration contains more elements.
 Object nextElement()
          Returns the next element of this enumeration.
 String toString()
          Provide a string representation of this node's value.
 

Field Detail

NIL

protected static final Tree.Node NIL
NIL is the sentinal Node that is used instead of null, simplifying the implementation of the red/black tree.


ABOVE

protected static final int ABOVE
See Also:
Constant Field Values

LEFT

protected static final int LEFT
See Also:
Constant Field Values

SITTING

protected static final int SITTING
See Also:
Constant Field Values

RIGHT

protected static final int RIGHT
See Also:
Constant Field Values

current

protected Tree.Node current

fromdir

protected int fromdir
Constructor Detail

Tree.Crawler

public Tree.Crawler(Tree.Node head)
Crawler constructor.


Tree.Crawler

protected Tree.Crawler(Tree.Node head,
                       int fromdir)
Crawler constructor.

Method Detail

hasMoreElements

public boolean hasMoreElements()
Tests if this enumeration contains more elements.

Specified by:
hasMoreElements in interface Enumeration

nextElement

public Object nextElement()
Returns the next element of this enumeration.

Specified by:
nextElement in interface Enumeration

toString

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


clone

public Object clone()
Make a shallow copy of the node crawler.


CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation