|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--openjava.ptree.ParseTreeObject | +--openjava.ptree.Leaf
The Leaf class is a token-node in the parse tree of OpenJava. Any object of this class or subclasses must be immutable.
ParseTree
,
NonLeaf
Field Summary | |
int |
charBegin
charBegin is the number of the character at which this token is. |
int |
line
line is the number of the line at which this token is. |
private String |
textString
textString is the text of this token. |
private int |
tokenID
tokenID is the identifer number of this token |
Fields inherited from class openjava.ptree.ParseTreeObject |
debugFlag, debugLevel, LN, out, writerStack |
Constructor Summary | |
Leaf(int term_num,
String str)
Allocates a new leaf(token) with its text. |
|
Leaf(int term_num,
String str,
int line,
int charBegin)
Allocates a new leaf(token) with its text and where this is. |
|
Leaf(String str)
Allocates a new leaf(token) with its text. |
Method Summary | |
void |
accept(ParseTreeVisitor v)
Accepts a ParseTreeVisitor object as the role of a
Visitor in the Visitor pattern, as the role of an Element in the
Visitor pattern. |
void |
childrenAccept(ParseTreeVisitor visitor)
Accepts a ParseTreeVisitor object as the role of a
Visitor in the Visitor pattern, as the role of an Element in the
Visitor pattern. |
boolean |
equals(ParseTree p)
Tests if the specified ptree-node equals to this leaf-node. |
boolean |
equals(String str)
Tests if the specified string equals to this leaf-node's text. |
OJClass |
getRowType(Environment env)
|
int |
getTokenID()
Returns the identifer-number of this token. |
ParseTree |
makeCopy()
Makes a new copy of this leaf-node. |
ParseTree |
makeRecursiveCopy()
Makes a new copy of this leaf-node. |
protected void |
replaceChildWith(ParseTree dist,
ParseTree replacement)
|
String |
toString()
Overrides to return its text as the string of this instance. |
void |
writeCode()
Writes the code of this token. |
Methods inherited from class openjava.ptree.ParseTreeObject |
clone, eq, eq, equal, flushPrintWriter, getDebugFlag, getNest, getObjectID, getParent, getPrintWriter, getTab, hashCode, lastObjectID, popNest, popPrintWriter, pushNest, pushPrintWriter, replace, setDebugFlag, setDebugLevel, setNest, setParent, setPrintStream, setTab, toFlattenString, writeDebug, writeDebugL, writeDebugLln, writeDebugln, writeDebugLR, writeDebugR, writeDebugRln, writeTab |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface openjava.ptree.ParseTree |
eq, getObjectID, replace, toFlattenString |
Field Detail |
private String textString
private int tokenID
public int line
public int charBegin
Constructor Detail |
public Leaf(String str)
str
- its text.public Leaf(int term_num, String str)
term_num
- dummy parameter.str
- its text.public Leaf(int term_num, String str, int line, int charBegin)
term_num
- dummy parameter.str
- its text.Method Detail |
protected void replaceChildWith(ParseTree dist, ParseTree replacement) throws ParseTreeException
replaceChildWith
in class ParseTreeObject
ParseTreeException
public String toString()
toString
in interface ParseTree
toString
in class ParseTreeObject
public ParseTree makeRecursiveCopy()
makeRecursiveCopy
in interface ParseTree
makeRecursiveCopy
in class ParseTreeObject
public ParseTree makeCopy()
makeCopy
in interface ParseTree
makeCopy
in class ParseTreeObject
public boolean equals(ParseTree p)
equals
in interface ParseTree
equals
in class ParseTreeObject
p
- the ptree-node to be tested.
public boolean equals(String str)
public int getTokenID()
public void writeCode()
writeCode
in interface ParseTree
writeCode
in class ParseTreeObject
public void childrenAccept(ParseTreeVisitor visitor)
ParseTreeVisitor
object as the role of a
Visitor in the Visitor pattern, as the role of an Element in the
Visitor pattern.
This invoke an appropriate visit()
method on each
child ParseTree
object with this visitor.
childrenAccept
in interface ParseTree
childrenAccept
in class ParseTreeObject
visitor
- a visitorpublic void accept(ParseTreeVisitor v) throws ParseTreeException
ParseTree
ParseTreeVisitor
object as the role of a
Visitor in the Visitor pattern, as the role of an Element in the
Visitor pattern.
This invoke an appropriate visit()
method on the
accepted visitor.
accept
in interface ParseTree
accept
in class ParseTreeObject
v
- a visitor
ParseTreeException
public OJClass getRowType(Environment env) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |