Coinjema
1.7

org.coinjema.collections
Class TreeSorter<T>

java.lang.Object
  extended by org.coinjema.collections.TreeSorter<T>
All Implemented Interfaces:
HashTreeTraverser<T>

public class TreeSorter<T>
extends Object
implements HashTreeTraverser<T>

Author:
Michael Stover To change the template for this generated type comment go to Window - Preferences - Java - Code Generation - Code and Comments

Constructor Summary
TreeSorter()
           
TreeSorter(Comparator<T> comper)
           
TreeSorter(T key)
           
TreeSorter(T key, Comparator<T> comper)
           
 
Method Summary
 void addNode(T arg0, HashTree<T> arg1)
          The tree traverses itself depth-first, calling addNode for each object it encounters as it goes.
 void processPath()
          Process path is called when a leaf is reached.
 void subtractNode()
          Indicates traversal has moved up a step, and the visitor should remove the top node from its stack structure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeSorter

public TreeSorter(T key,
                  Comparator<T> comper)

TreeSorter

public TreeSorter(Comparator<T> comper)

TreeSorter

public TreeSorter()

TreeSorter

public TreeSorter(T key)
Method Detail

addNode

public void addNode(T arg0,
                    HashTree<T> arg1)
Description copied from interface: HashTreeTraverser
The tree traverses itself depth-first, calling addNode for each object it encounters as it goes. This is a callback method, and should not be called except by a HashTree during traversal.

Specified by:
addNode in interface HashTreeTraverser<T>
Parameters:
arg0 - the node currently encountered
arg1 - the HashTree under the node encountered

subtractNode

public void subtractNode()
Description copied from interface: HashTreeTraverser
Indicates traversal has moved up a step, and the visitor should remove the top node from its stack structure. This is a callback method, and should not be called except by a HashTree during traversal.

Specified by:
subtractNode in interface HashTreeTraverser<T>

processPath

public void processPath()
Description copied from interface: HashTreeTraverser
Process path is called when a leaf is reached. If a visitor wishes to generate Lists of path elements to each leaf, it should keep a Stack data structure of nodes passed to it with addNode, and removing top items for every HashTreeTraverser.subtractNode() call. This is a callback method, and should not be called except by a HashTree during traversal.

Specified by:
processPath in interface HashTreeTraverser<T>

Coinjema
1.7

Public Domain Software.