dk.brics.grammar.ast
Class LeafNode

java.lang.Object
  extended by dk.brics.grammar.ast.Node
      extended by dk.brics.grammar.ast.LeafNode

public class LeafNode
extends Node

Leaf node, representing a substring of the original string.


Constructor Summary
LeafNode(int i, int j)
          Constructs a new leaf node.
 
Method Summary
 String getString(String x)
          Returns the substring represented by this node.
 void print(String x, StringBuilder b)
          Prints this node.
 void setString(String s)
          Sets the string.
 void visitBy(NodeVisitor v)
          Visits this node.
 
Methods inherited from class dk.brics.grammar.ast.Node
getFromIndex, getToIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LeafNode

public LeafNode(int i,
                int j)
Constructs a new leaf node.

Parameters:
i - from index
j - to index (not included)
Method Detail

getString

public String getString(String x)
Returns the substring represented by this node.

Overrides:
getString in class Node
Parameters:
x - original string (irrelevant if substring has been set by setString(String)})
Returns:
substring

print

public void print(String x,
                  StringBuilder b)
Description copied from class: Node
Prints this node.

Specified by:
print in class Node
Parameters:
x - original string
b - string buffer for output

setString

public void setString(String s)
Sets the string. (Overrides the original substring.)

Parameters:
s - new string

visitBy

public void visitBy(NodeVisitor v)
Description copied from class: Node
Visits this node.

Specified by:
visitBy in class Node
Parameters:
v - visitor


Copyright © 2005-2008 Anders Møller.