|
mwalk Platform 0.3.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--mwalk.visitor.AbstractVisitor
Abstract class which defines a set of default methods for most visitors. This class defines methods for Visitor, UpVisitor, and DownVisitor although it only implements Visitor. This allows sub-classes to regulate which calls actually get made.
Field Summary | |
private static java.lang.String |
CFG_BASE
Base of keys in configuration file |
protected ActivityEvaluator |
eval
Evaluator used to determine activity when walking |
protected java.util.Hashtable |
seen
Hash table used to track who we have seen and processed |
protected boolean |
verbose
Whether the visitor prints verbose messages in verbose mode |
Constructor Summary | |
AbstractVisitor()
Default constructor. |
Method Summary | |
boolean |
again(Tree tree)
Check whether the visitor wants another pass over the tree. |
protected boolean |
cfgBoolean(java.lang.String key)
Get a configuration value as a boolean. |
protected int |
cfgInt(java.lang.String key)
Get a configuration value as an integer. |
protected java.lang.String |
cfgString(java.lang.String key)
Get a configuration value as a string. |
protected Visitor |
cfgVisitor(java.lang.String key)
Get a configuration value as a visitor object. |
ActivityEvaluator |
evaluator()
Return the current activity evaluator. |
void |
evaluator(ActivityEvaluator eval)
Set the current activity evaluator. |
TreeNode[] |
getChildren(Tree tree,
TreeNode node)
Retrieve the list of children of this node. |
TreeNode[] |
getParents(Tree tree,
TreeNode node)
Retrieve the list of parents of this node. |
java.util.Enumeration |
getReceivers(Tree tree)
Get a list of active receivers. |
boolean |
haveSeen(TreeNode node)
|
boolean |
haveVisited(TreeNode node)
|
boolean |
init(Tree tree)
Initialize the visitor state. |
boolean |
markSeen(TreeNode node)
|
boolean |
markVisited(TreeNode node)
|
boolean |
nextReceiver(Tree tree,
Receiver recv)
Check whether the next receiver should start a visiting path. |
boolean |
postfix()
Whether to visit after visiting parent/children. |
boolean |
prefix()
Whether to visit prior to visiting parent/children. |
void |
reset(Tree tree)
Reset the visitor for a new pass over the tree. |
boolean |
verbose()
Check whether the visitor is verbose. |
java.lang.Object |
visitDown(Tree tree,
TreeNode node)
Visit the current node prior to visiting children. |
java.lang.Object |
visitDown(Tree tree,
TreeNode node,
java.util.Vector list)
Visit the current node after visiting children. |
java.lang.Object |
visitUp(Tree tree,
TreeNode node)
Visit the current node prior to visiting parent. |
java.lang.Object |
visitUp(Tree tree,
TreeNode node,
java.util.Vector list)
Visit the current node after visiting parent. |
boolean |
walkDown()
Whether to walk down the tree. |
boolean |
walkUp()
Whether to walk up the tree. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static final java.lang.String CFG_BASE
protected ActivityEvaluator eval
protected java.util.Hashtable seen
protected boolean verbose
Constructor Detail |
public AbstractVisitor()
Method Detail |
public ActivityEvaluator evaluator()
ActivityEvaluator
current evaluatorpublic void evaluator(ActivityEvaluator eval)
ActivityEvaluator
- new evaluatorpublic boolean verbose()
boolean
whether visitor is verbosepublic boolean prefix()
boolean
whether to visit priorpublic boolean postfix()
boolean
whether to visit afterpublic boolean init(Tree tree)
Tree
- current tree instanceboolean
whether to walk againpublic void reset(Tree tree)
Tree
- vistited treepublic boolean again(Tree tree)
Tree
- vistited treeboolean
whether to walk againpublic boolean walkUp()
boolean
whether to walk up the treepublic java.util.Enumeration getReceivers(Tree tree)
Tree
- current tree instanceEnumeration
list of receivers to visitpublic boolean nextReceiver(Tree tree, Receiver recv)
Tree
- current tree instanceReceiver
- next receiverboolean
whether to visit next receiverpublic java.lang.Object visitUp(Tree tree, TreeNode node) throws VisitException
Tree
- current tree instanceTreeNode
- current nodeObject
optional return value to pass back along the pathVisitException
- if a problem ocurred during visitpublic java.lang.Object visitUp(Tree tree, TreeNode node, java.util.Vector list) throws VisitException
Tree
- current tree instanceTreeNode
- current nodeObject
- list of return values passed back along the pathObject
optional return value to pass back along the pathVisitException
- if a problem ocurred during visitpublic TreeNode[] getParents(Tree tree, TreeNode node)
Tree
- vistited treeTreeNode
- currently visited nodeTreeNode[]
array of parent nodes of currently visited nodepublic boolean walkDown()
boolean
whether to walk down the treepublic java.lang.Object visitDown(Tree tree, TreeNode node) throws VisitException
Tree
- current tree instanceTreeNode
- current nodeObject
optional return value to pass back along the pathVisitException
- if a problem ocurred during visitpublic java.lang.Object visitDown(Tree tree, TreeNode node, java.util.Vector list) throws VisitException
Tree
- current tree instanceTreeNode
- current nodeObject
- list of return values passed back along the pathObject
optional return value to pass back along the pathVisitException
- if a problem ocurred during visitpublic TreeNode[] getChildren(Tree tree, TreeNode node)
Tree
- vistited treeTreeNode
- currently visited nodeTreeNode[]
array of child nodes of currently visited nodepublic boolean haveSeen(TreeNode node)
public boolean haveVisited(TreeNode node)
public boolean markSeen(TreeNode node)
public boolean markVisited(TreeNode node)
protected java.lang.String cfgString(java.lang.String key)
String
- key stringString
config valueprotected int cfgInt(java.lang.String key)
String
- key stringint
config valueprotected boolean cfgBoolean(java.lang.String key)
String
- key stringboolean
config valueprotected Visitor cfgVisitor(java.lang.String key)
String
- key stringVisitor
instantiated visitor
|
mwalk Platform 0.3.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |