|
||||||||||
| 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 ParseTreeObjectParseTreeExceptionpublic String toString()
toString in interface ParseTreetoString in class ParseTreeObjectpublic ParseTree makeRecursiveCopy()
makeRecursiveCopy in interface ParseTreemakeRecursiveCopy in class ParseTreeObjectpublic ParseTree makeCopy()
makeCopy in interface ParseTreemakeCopy in class ParseTreeObjectpublic boolean equals(ParseTree p)
equals in interface ParseTreeequals in class ParseTreeObjectp - the ptree-node to be tested.
public boolean equals(String str)
public int getTokenID()
public void writeCode()
writeCode in interface ParseTreewriteCode in class ParseTreeObjectpublic 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 ParseTreechildrenAccept in class ParseTreeObjectvisitor - a visitor
public void accept(ParseTreeVisitor v)
throws ParseTreeException
ParseTreeParseTreeVisitor 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 ParseTreeaccept in class ParseTreeObjectv - 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 | |||||||||