mwalk Platform 0.3.0

mwalk.visitor
Class DataVisitor

java.lang.Object
  |
  +--mwalk.visitor.AbstractVisitor
        |
        +--mwalk.visitor.DataVisitor

public class DataVisitor
extends AbstractVisitor
implements DownVisitor

A visitor that assigns data elements to each node in the tree from an ecternal file. The file should be formatted with each line containing a node's adress and the associated data separated by a space.

Version:
1.0
Author:
Robert Chalmers

Field Summary
private static java.lang.String CFG_BASE
          Base of keys in configuration file
protected  java.util.Properties data
          List of data items keyed by the node's address
protected  java.lang.String def_filename
          Default filename if none supplied
protected  java.lang.String filename
          Filename to use for data
protected  java.lang.String type
          Type of data - used as node's hash key
 
Fields inherited from class mwalk.visitor.AbstractVisitor
CFG_BASE, eval, seen, verbose
 
Constructor Summary
DataVisitor()
          Default constructor.
DataVisitor(java.lang.String filename)
          Constructor.
 
Method Summary
 java.lang.String getFilename()
          Retrieve the current filename.
 boolean init(Tree tree)
          Initialize visitor.
 boolean prefix()
          Whether to visit prior to visiting parent/children.
 void setFilename(java.lang.String filename)
          Set the current filename prior to init().
 java.lang.Object visitDown(Tree tree, TreeNode node)
          Visit the current node prior to visiting children.
 
Methods inherited from class mwalk.visitor.AbstractVisitor
again, cfgBoolean, cfgInt, cfgString, cfgVisitor, evaluator, evaluator, getChildren, 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

CFG_BASE

private static final java.lang.String CFG_BASE
Base of keys in configuration file

filename

protected java.lang.String filename
Filename to use for data

def_filename

protected java.lang.String def_filename
Default filename if none supplied

type

protected java.lang.String type
Type of data - used as node's hash key

data

protected java.util.Properties data
List of data items keyed by the node's address
Constructor Detail

DataVisitor

public DataVisitor()
Default constructor.

DataVisitor

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

getFilename

public java.lang.String getFilename()
Retrieve the current filename.
Returns:
String current filename

setFilename

public void setFilename(java.lang.String filename)
Set the current filename prior to init().
Parameters:
String - new filename

prefix

public boolean prefix()
Description copied from interface: Visitor
Whether to visit prior to visiting parent/children.
Overrides:
prefix in class AbstractVisitor
Tags copied from interface: Visitor
Returns:
boolean whether to visit prior

init

public boolean init(Tree tree)
Initialize visitor.
Overrides:
init in class AbstractVisitor
Parameters:
Tree - current tree instance

visitDown

public java.lang.Object visitDown(Tree tree,
                                  TreeNode node)
Visit the current node prior to visiting children.
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