mwalk Platform 0.3.0

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
 
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
DegreeCountVisitor()
          Default constructor.
DegreeCountVisitor(java.lang.String filename)
          Constructor.
 
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.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, 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
 

Field Detail

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
Constructor Detail

DegreeCountVisitor

public DegreeCountVisitor()
Default constructor.

DegreeCountVisitor

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

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 instance
TreeNode - current tree node
DegreeCount - 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 instance
TreeNode - 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 instance
TreeNode - current node
Vector - 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

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