mwalk Platform 0.3.0

mwalk.visitor
Class LinkCountVisitor

java.lang.Object
  |
  +--mwalk.visitor.AbstractVisitor
        |
        +--mwalk.visitor.PrintVisitor
              |
              +--mwalk.visitor.LinkCountVisitor

public class LinkCountVisitor
extends PrintVisitor
implements DownVisitor

A visitor used to count the number of links for each receiver along the active tree.

Version:
1.0
Author:
Robert Chalmers

Field Summary
private static java.lang.String DEF_FILENAME
          Default file name if none supplied
 
Fields inherited from class mwalk.visitor.PrintVisitor
CFG_BASE, def_filename, filename, ps
 
Fields inherited from class mwalk.visitor.AbstractVisitor
CFG_BASE, eval, seen, verbose
 
Constructor Summary
LinkCountVisitor()
          Default constructor.
LinkCountVisitor(java.lang.String filename)
          Constructor.
 
Method Summary
 boolean init(Tree tree)
          Initialize visitor.
 boolean prefix()
          Whether to visit prior to visiting parent/children.
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.
 
Methods inherited from class mwalk.visitor.PrintVisitor
getChildren, getFilename, printData, printData, setFilename
 
Methods inherited from class mwalk.visitor.AbstractVisitor
again, cfgBoolean, cfgInt, cfgString, cfgVisitor, evaluator, evaluator, getParents, getReceivers, haveSeen, haveVisited, markSeen, markVisited, nextReceiver, postfix, 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
 

Field Detail

DEF_FILENAME

private static final java.lang.String DEF_FILENAME
Default file name if none supplied
Constructor Detail

LinkCountVisitor

public LinkCountVisitor()
Default constructor.

LinkCountVisitor

public LinkCountVisitor(java.lang.String filename)
Constructor.
Parameters:
String - new default filename
Method Detail

prefix

public boolean prefix()
Whether to visit prior to visiting parent/children.
Overrides:
prefix in class AbstractVisitor
Returns:
boolean whether to visit prior

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

init

public boolean init(Tree tree)
Initialize visitor.
Overrides:
init in class PrintVisitor
Parameters:
Tree - current tree instance
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 instance
TreeNode - current node
Returns:
Object optional return value to pass back along the path
Throws:
VisitException - if a problem ocurred during visit

mwalk Platform 0.3.0

Submit a bug or feature mwalk Platform API Specification 0.3.0
Sensitivity: {Public:Research}
Copyright(c) 2000, Robert Chalmers