|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | 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. |
Fields inherited from class openjava.ptree.ParseTreeObject |
debugFlag,
debugLevel,
LN,
out,
writerStack |
Constructor Summary | |
Leaf(int term_num,
java.lang.String str)
Allocates a new leaf(token) with its text. |
|
Leaf(int term_num,
java.lang.String str,
int line,
int charBegin)
Allocates a new leaf(token) with its text and where this is. |
|
Leaf(java.lang.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(java.lang.String str)
Tests if the specified string equals to this leaf-node's text. |
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)
|
java.lang.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 |
Field Detail |
public int line
public int charBegin
Constructor Detail |
public Leaf(java.lang.String str)
term_num
- dummy parameter.str
- its text.public Leaf(int term_num, java.lang.String str)
term_num
- dummy parameter.str
- its text.public Leaf(int term_num, java.lang.String str, int line, int charBegin)
term_num
- dummy parameter.str
- its text.Method Detail |
protected void replaceChildWith(ParseTree dist, ParseTree replacement) throws ParseTreeException
public java.lang.String toString()
public ParseTree makeRecursiveCopy()
public ParseTree makeCopy()
public boolean equals(ParseTree p)
p
- the ptree-node to be tested.public boolean equals(java.lang.String str)
p
- the ptree-node to be tested.public int getTokenID()
public void writeCode()
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.
visitor
- a visitorpublic void accept(ParseTreeVisitor v) throws ParseTreeException
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.
visitor
- a visitor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |