|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | 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
|
private static int |
idCount
The idCount counts up generated ptree objects |
protected static String |
LN
|
private static int |
nest
to write debugging code |
private int |
objectID
The object ID is object identifier number in order to determine two ptree variables refer to the same object. |
protected static PrintWriter |
out
this is used as like grobal variable in ParseTree class-family. |
private ParseTreeObject |
parent
|
private static String |
tab
to write debugging code |
protected static 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 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 name the ID represents |
ParseTreeObject |
getParent()
|
static PrintWriter |
getPrintWriter()
|
static String |
getTab()
|
int |
hashCode()
|
static int |
lastObjectID()
|
ParseTree |
makeCopy()
shallow copy |
abstract ParseTree |
makeRecursiveCopy()
deep copy |
static void |
popNest()
|
static PrintWriter |
popPrintWriter()
|
static void |
pushNest()
|
static void |
pushPrintWriter(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)
|
private void |
setObjectID()
Increments idCount class variable and set the instance's object identifier number to the number of idCount variable. |
protected void |
setParent(ParseTreeObject parent)
|
static void |
setPrintStream(PrintStream pstream)
Sets the writer to the one from the specified stream. |
static void |
setTab(String str)
|
String |
toFlattenString()
Generates the string expression from this node. |
String |
toString()
Generates a string object of regular Java source code representing this parse-tree. |
abstract void |
writeCode()
Deprecated. |
protected static void |
writeDebug(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 String LN
private ParseTreeObject parent
protected static WriterStack writerStack
protected static PrintWriter out
protected static boolean debugFlag
protected static int debugLevel
private static String tab
private static int nest
private int objectID
private static int idCount
Constructor Detail |
public ParseTreeObject()
Method Detail |
public final ParseTreeObject getParent()
protected final void setParent(ParseTreeObject parent)
public final void replace(ParseTree replacement) throws ParseTreeException
replace
in interface ParseTree
ParseTreeException
protected abstract void replaceChildWith(ParseTree dist, ParseTree replacement) throws ParseTreeException
ParseTreeException
protected final Object clone()
clone
in class Object
public ParseTree makeCopy()
makeCopy
in interface ParseTree
public abstract ParseTree makeRecursiveCopy()
makeRecursiveCopy
in interface ParseTree
public abstract boolean equals(ParseTree p)
equals
in interface ParseTree
public final boolean eq(ParseTree p)
eq
in interface ParseTree
public int hashCode()
hashCode
in class Object
public String toString()
toString
in interface ParseTree
toString
in class Object
public static void setPrintStream(PrintStream pstream)
pstream
- print streampublic static PrintWriter getPrintWriter()
public static PrintWriter popPrintWriter()
public static void pushPrintWriter(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(String str)
public static 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(String str)
protected static void writeTab()
public abstract void writeCode()
writeCode
in interface ParseTree
public static final boolean eq(ParseTree p, ParseTree q)
p
- the ptree-nodeq
- the ptree-node
public static final boolean equal(ParseTree p, ParseTree q)
p
- the nodeq
- the node to compare
public static final int lastObjectID()
private final void setObjectID()
public final int getObjectID()
getObjectID
in interface ParseTree
public String toFlattenString()
This method is useful to embed ptree objects as a string literal in source code.
toFlattenString
in interface ParseTree
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.
accept
in interface ParseTree
visitor
- a visitor
ParseTreeException
public 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.
childrenAccept
in interface ParseTree
visitor
- a visitor
ParseTreeException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |