mwalk.visitor
Class DegreeCountVisitor
java.lang.Object
|
+--mwalk.visitor.AbstractVisitor
|
+--mwalk.visitor.PrintVisitor
|
+--mwalk.visitor.DegreeCountVisitor
- public class DegreeCountVisitor
- extends PrintVisitor
- implements DownVisitor
A visitor used to count the degree of each node along the
active tree. This visitor assumes that the node's data contain
the current depth, otherwise the depth will be reported as zero.
- Version:
- 1.0
- Author:
- Robert Chalmers
Field Summary |
private static java.lang.String |
CFG_BASE
Base of keys in configuration file |
private static java.lang.String |
DEF_FILENAME
Default filename |
protected boolean |
intraType
Whether to report degrees only within a specific type of node |
protected java.lang.String |
type
Type of identifying data to print for each entry |
Method Summary |
boolean |
init(Tree tree)
Initialize the visitor state. |
boolean |
postfix()
Whether to visit after visiting parent/children. |
protected void |
printData(Tree tree,
TreeNode node,
DegreeCount count)
Print a single line of data for a node. |
protected void |
printHeader(Tree tree)
Print visitor's header info at start of file. |
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. |
Methods inherited from class mwalk.visitor.AbstractVisitor |
again,
cfgBoolean,
cfgInt,
cfgString,
cfgVisitor,
evaluator,
evaluator,
getParents,
getReceivers,
haveSeen,
haveVisited,
markSeen,
markVisited,
nextReceiver,
prefix,
reset,
verbose,
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
DEF_FILENAME
private static final java.lang.String DEF_FILENAME
- Default filename
type
protected java.lang.String type
- Type of identifying data to print for each entry
intraType
protected boolean intraType
- Whether to report degrees only within a specific type of node
DegreeCountVisitor
public DegreeCountVisitor()
- Default constructor.
DegreeCountVisitor
public DegreeCountVisitor(java.lang.String filename)
- Constructor.
- Parameters:
String
- new default filename
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 PrintVisitor
- Parameters:
Tree
- current tree instance- Returns:
boolean
whether to walk again
printHeader
protected void printHeader(Tree tree)
- Print visitor's header info at start of file.
- Overrides:
- printHeader in class PrintVisitor
- Parameters:
Tree
- current tree instance
printData
protected void printData(Tree tree,
TreeNode node,
DegreeCount count)
- Print a single line of data for a node.
- Parameters:
Tree
- current tree instanceTreeNode
- current tree nodeDegreeCount
- current degree count
visitDown
public java.lang.Object visitDown(Tree tree,
TreeNode node)
- Visit the current node prior to visiting children.
This method is called if prefix() returns true.
- Specified by:
- visitDown in interface DownVisitor
- Overrides:
- visitDown in class AbstractVisitor
- Parameters:
Tree
- current tree instanceTreeNode
- current node- Returns:
Object
optional return value to pass back along the path- Throws:
VisitException
- if a problem ocurred during visit
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 nodeVector
- 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
Submit a bug or feature mwalk Platform API Specification 0.3.0
Sensitivity: {Public:Research}
Copyright(c) 2000, Robert Chalmers