|
Coinjema 1.7 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface HashTreeTraverser<T>
By implementing this interface, a class can easily traverse a HashTree object, and be notified via callbacks of certain events. There are three such events:
addNode(Object,HashTree)
method is called. It is handed the
object at that node, and the entire sub-tree of the node.processPath()
method. It is
the traversing class's responsibility to know the path that has just
finished (this can be done by keeping a simple stack of all added
nodes).subtractNode()
is
called. Again, it is the traverser's responsibility to know which
node has been retraced.processPath()
call is sent. As
the traversal backs up, nodes are subtracted.
The traversal is a depth-first traversal.
HashTree
,
SearchByClass
Method Summary | |
---|---|
void |
addNode(T node,
HashTree<T> subTree)
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. |
Method Detail |
---|
void addNode(T node, HashTree<T> subTree)
node
- the node currently encounteredsubTree
- the HashTree under the node encounteredvoid subtractNode()
void processPath()
subtractNode()
call. This is a callback
method, and should not be called except by a HashTree during traversal.
|
Coinjema 1.7 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |