mwalk.visitor
Class MetricVisitor
java.lang.Object
|
+--mwalk.visitor.AbstractVisitor
|
+--mwalk.visitor.PrintVisitor
|
+--mwalk.visitor.MetricVisitor
- Direct Known Subclasses:
- BasicMetricVisitor
- public abstract class MetricVisitor
- extends PrintVisitor
- implements DownVisitor
Abstract base class defining the looping behavior of most metric visitors.
- 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 file name if none supplied |
protected double |
offset
|
protected long |
periods
|
protected long |
time
|
protected double |
timeval
|
Methods inherited from class mwalk.visitor.AbstractVisitor |
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 file name if none supplied
time
protected long time
timeval
protected double timeval
offset
protected double offset
periods
protected long periods
MetricVisitor
public MetricVisitor()
- Default constructor.
MetricVisitor
public MetricVisitor(java.lang.String filename)
- Constructor.
- Parameters:
String
- new default filename
MetricVisitor
public MetricVisitor(long periods)
- Constructor.
- Parameters:
long
- number of periods to cover session
MetricVisitor
public MetricVisitor(java.lang.String filename,
long periods)
- Constructor.
- Parameters:
String
- new default filenamelong
- number of periods to cover session
getTime
public long getTime()
incTime
public long incTime()
setTime
public void setTime(double tv)
startTime
public void startTime(Tree tree)
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
again
public boolean again(Tree tree)
- Check whether the visitor wants another pass over the tree.
- Overrides:
- again in class AbstractVisitor
- Parameters:
Tree
- vistited tree- Returns:
boolean
whether to walk again
visitDown
public java.lang.Object visitDown(Tree tree,
TreeNode node)
throws VisitException
- 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
getChildren
public TreeNode[] getChildren(Tree tree,
TreeNode node)
- Get a list of children for the current node applying correct activity
semantics.
- Specified by:
- getChildren in interface DownVisitor
- Overrides:
- getChildren in class PrintVisitor
- Parameters:
Tree
- current tree instanceTreeNode
- current node- Returns:
TreeNode[]
list of active children nodes
doVisit
protected abstract MetricCount doVisit(Tree tree,
TreeNode node,
java.util.Vector list)
throws VisitException
process
protected abstract void process(Tree tree)
throws VisitException
Submit a bug or feature mwalk Platform API Specification 0.3.0
Sensitivity: {Public:Research}
Copyright(c) 2000, Robert Chalmers