Building Parsers with Java

sjm.examples.pretty
Class CompositeNode

java.lang.Object
  |
  +--sjm.examples.pretty.ComponentNode
        |
        +--sjm.examples.pretty.CompositeNode

public class CompositeNode
extends ComponentNode

This class provides a composite node that can contain other nodes.


Field Summary
protected  java.util.Vector children
           
 
Fields inherited from class sjm.examples.pretty.ComponentNode
value
 
Constructor Summary
CompositeNode(java.lang.Object v)
          Create a node that can contain other nodes, and that holds the given value.
 
Method Summary
 void add(ComponentNode node)
          Add a node after the currently held nodes.
 void insert(ComponentNode n)
          Add a node before the currently held nodes.
protected  java.lang.String toString(int depth, boolean label, java.util.Vector visited)
           
 
Methods inherited from class sjm.examples.pretty.ComponentNode
indent, toString, toStringWithoutLabels
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

children

protected java.util.Vector children
Constructor Detail

CompositeNode

public CompositeNode(java.lang.Object v)
Create a node that can contain other nodes, and that holds the given value.
Method Detail

add

public void add(ComponentNode node)
Add a node after the currently held nodes.
Parameters:
ComponentNode - another node, either a composite or a terminal node

insert

public void insert(ComponentNode n)
Add a node before the currently held nodes.
Parameters:
ComponentNode - another node, either a composite or a terminal node

toString

protected java.lang.String toString(int depth,
                                    boolean label,
                                    java.util.Vector visited)
Overrides:
toString in class ComponentNode

by Steve Metsker