mwalk.visitor
Class CollapseVisitor
java.lang.Object
|
+--mwalk.visitor.AbstractVisitor
|
+--mwalk.visitor.CollapseVisitor
- public class CollapseVisitor
- extends AbstractVisitor
- implements DownVisitor
A visitor that collapses the primary tree based on matching data at
each node. The type of data referenced can be specified in the
config file.
- Version:
- 1.0
- Author:
- Robert Chalmers
Field Summary |
private static java.lang.String |
CFG_BASE
Base of keys in configuration file |
protected java.lang.String |
type
Type of data - used as node's hash key |
Methods inherited from class mwalk.visitor.AbstractVisitor |
again,
cfgBoolean,
cfgInt,
cfgString,
cfgVisitor,
evaluator,
evaluator,
getParents,
getReceivers,
haveSeen,
haveVisited,
markSeen,
markVisited,
nextReceiver,
prefix,
reset,
verbose,
visitDown,
visitUp,
visitUp,
walkDown,
walkUp |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
CFG_BASE
private static final java.lang.String CFG_BASE
- Base of keys in configuration file
type
protected java.lang.String type
- Type of data - used as node's hash key
CollapseVisitor
public CollapseVisitor()
- Default constructor.
postfix
public boolean postfix()
- Whether to visit after visiting parent/children.
- Overrides:
- postfix in class AbstractVisitor
- Returns:
boolean
whether to visit after
init
public boolean init(Tree tree)
- Initialize the visitor state.
- Overrides:
- init in class AbstractVisitor
- Parameters:
Tree
- current tree instance- Returns:
boolean
whether to walk again
transfer
protected void transfer(TreeNode src,
TreeNode dst)
- Transfer children from one node to another.
- Parameters:
TreeNode
- node to transfer fromTreeNode
- node to transfer to
visitDown
public java.lang.Object visitDown(Tree tree,
TreeNode node,
java.util.Vector list)
throws VisitException
- Visit the current node after visiting children.
This method is called if postfix() returns true.
- Specified by:
- visitDown in interface DownVisitor
- Overrides:
- visitDown in class AbstractVisitor
- Parameters:
Tree
- current tree instanceTreeNode
- current nodeObject
- list of return values passed back along the path- Returns:
Object
optional return value to pass back along the path- Throws:
VisitException
- if a problem ocurred during visit
getChildren
public TreeNode[] getChildren(Tree tree,
TreeNode node)
- Retrieve the list of children of this node.
- Specified by:
- getChildren in interface DownVisitor
- Overrides:
- getChildren in class AbstractVisitor
- Parameters:
Tree
- vistited treeTreeNode
- currently visited node- Returns:
TreeNode[]
array of child nodes of currently visited node
Submit a bug or feature mwalk Platform API Specification 0.3.0
Sensitivity: {Public:Research}
Copyright(c) 2000, Robert Chalmers