|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--openjava.ptree.ParseTreeObject
The ParseTree class presents for the node of parse tree. This may be a token node, Leaf, or may be a nonterminal node, NonLeaf.
Leaf
,
NonLeaf
Field Summary | |
protected static boolean |
debugFlag
to write debugging code |
protected static int |
debugLevel
|
protected static java.lang.String |
LN
Why this modifier is not final ? - Because of javac bug in excuting it with -O option. |
protected static java.io.PrintWriter |
out
this is used as like grobal variable in ParseTree class-family. |
protected static openjava.tools.WriterStack |
writerStack
this is used as like grobal variable in ParseTree class-family. |
Constructor Summary | |
ParseTreeObject()
Arrocates new parse-tree object and set identifier number on the object. |
Method Summary | |
abstract void |
accept(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. |
abstract 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. |
protected java.lang.Object |
clone()
clone() is fixed as a shallow copy. |
boolean |
eq(ParseTree p)
Tests if this parse-tree-node's value equals to the specified ptree-node's. |
static boolean |
eq(ParseTree p,
ParseTree q)
Return true if only they refer to the same object. |
static boolean |
equal(ParseTree p,
ParseTree q)
May return true if two ptree-nodes don't refer to not the same objects but their contents are equivalent. |
abstract boolean |
equals(ParseTree p)
Tests if this parse-tree-node's value equals to the specified ptree-node's. |
static void |
flushPrintWriter()
|
static boolean |
getDebugFlag()
|
static int |
getNest()
|
int |
getObjectID()
Returns |
ParseTreeObject |
getParent()
|
static java.io.PrintWriter |
getPrintWriter()
|
static java.lang.String |
getTab()
|
int |
hashCode()
|
static int |
lastObjectID()
|
ParseTree |
makeCopy()
shallow copy |
abstract ParseTree |
makeRecursiveCopy()
deep copy |
static void |
popNest()
|
static java.io.PrintWriter |
popPrintWriter()
|
static void |
pushNest()
|
static void |
pushPrintWriter(java.io.PrintWriter pw)
|
void |
replace(ParseTree replacement)
|
protected abstract void |
replaceChildWith(ParseTree dist,
ParseTree replacement)
|
static void |
setDebugFlag(boolean df)
|
static void |
setDebugLevel(int n)
|
static void |
setNest(int i)
|
protected void |
setParent(ParseTreeObject parent)
|
static void |
setPrintStream(java.io.PrintStream pstream)
Sets the writer to the one from the specified stream. |
static void |
setTab(java.lang.String str)
|
java.lang.String |
toFlattenString()
Generates the string expression from this node. |
java.lang.String |
toString()
Generates a string object of regular Java source code representing this parse-tree. |
abstract void |
writeCode()
Deprecated. |
protected static void |
writeDebug(java.lang.String str)
|
protected void |
writeDebugL()
|
protected static void |
writeDebugLln()
|
protected static void |
writeDebugln()
|
protected static void |
writeDebugLR()
|
protected static void |
writeDebugR()
|
protected static void |
writeDebugRln()
|
protected static void |
writeTab()
|
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected static java.lang.String LN
protected static openjava.tools.WriterStack writerStack
protected static java.io.PrintWriter out
protected static boolean debugFlag
protected static int debugLevel
Constructor Detail |
public ParseTreeObject()
Method Detail |
public final ParseTreeObject getParent()
protected final void setParent(ParseTreeObject parent)
public final void replace(ParseTree replacement) throws ParseTreeException
protected abstract void replaceChildWith(ParseTree dist, ParseTree replacement) throws ParseTreeException
protected final java.lang.Object clone()
public ParseTree makeCopy()
public abstract ParseTree makeRecursiveCopy()
public abstract boolean equals(ParseTree p)
public final boolean eq(ParseTree p)
public int hashCode()
public java.lang.String toString()
public static void setPrintStream(java.io.PrintStream pstream)
pstrem
- print streampublic static java.io.PrintWriter getPrintWriter()
public static java.io.PrintWriter popPrintWriter()
public static void pushPrintWriter(java.io.PrintWriter pw)
public static void flushPrintWriter()
public static void setDebugFlag(boolean df)
public static void setDebugLevel(int n)
public static boolean getDebugFlag()
public static void setTab(java.lang.String str)
public static java.lang.String getTab()
public static void setNest(int i)
public static int getNest()
public static void pushNest()
public static void popNest()
protected void writeDebugL()
protected static void writeDebugR()
protected static void writeDebugLR()
protected static void writeDebugLln()
protected static void writeDebugRln()
protected static void writeDebugln()
protected static void writeDebug(java.lang.String str)
protected static void writeTab()
public abstract void writeCode()
public static final boolean eq(ParseTree p, ParseTree q)
p
- the ptree-nodeq
- the ptree-nodepublic static final boolean equal(ParseTree p, ParseTree q)
p
- the nodeq
- the node to comparepublic static final int lastObjectID()
public final int getObjectID()
id
- IDpublic java.lang.String toFlattenString()
This method is useful to embed ptree objects as a string literal in source code.
public abstract void accept(ParseTreeVisitor visitor) 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 visitorpublic abstract void childrenAccept(ParseTreeVisitor visitor) 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 each
child ParseTree
object with this visitor.
visitor
- a visitor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |