openjava.ptree
Interface ParseTree

All Known Subinterfaces:
Expression, MemberDeclaration, Statement, VariableInitializer
All Known Implementing Classes:
AliasedExpression, AllocationExpression, ArrayAccess, ArrayAllocationExpression, ArrayInitializer, AssignmentExpression, BinaryExpression, Block, BreakStatement, CastExpression, ClassDeclaration, ClassLiteral, ConditionalExpression, ConstructorDeclaration, ContinueStatement, DoWhileStatement, EmptyStatement, ExpressionObject, ExpressionStatement, FieldAccess, FieldDeclaration, ForStatement, IfStatement, InstanceofExpression, LabeledStatement, Leaf, List, Literal, MemberInitializer, MethodCall, MethodDeclaration, NonLeaf, ParseTreeObject, ReturnStatement, SelfAccess, SetExpression, SwitchStatement, SynchronizedStatement, ThrowStatement, TryStatement, UnaryExpression, Variable, VariableDeclaration, WhileStatement

public interface ParseTree

The ParseTree class presents for the node of parse tree. This may be a token node, Leaf, or may be a nonterminal node, NonLeaf.

See Also:
Leaf, NonLeaf

Method Summary
 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.
 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 eq(ParseTree p)
          Tests if this parse-tree-node's value equals to the specified ptree-node's.
 boolean equals(ParseTree p)
          Tests if this parse-tree-node's value equals to the specified ptree-node's.
 int getObjectID()
          Returns the Identifier Number of this object
 ParseTree makeCopy()
          Makes a new copy of this nonleaf-node as a ptree-node.
 ParseTree makeRecursiveCopy()
          Makes a new copy (another object) of this nonleaf-node recursively.
 void replace(ParseTree replacement)
           
 String toFlattenString()
          Generates the string expression from this node.
 String toString()
          Generates string which presents for this parse-tree
 void writeCode()
          Deprecated.  
 

Method Detail

replace

public void replace(ParseTree replacement)
             throws ParseTreeException
ParseTreeException

makeRecursiveCopy

public ParseTree makeRecursiveCopy()
Makes a new copy (another object) of this nonleaf-node recursively. The objects contained by this object will also be copied.

Returns:
the copy of this nonleaf-node as a ptree-node.

makeCopy

public ParseTree makeCopy()
Makes a new copy of this nonleaf-node as a ptree-node. The objects contained by the new object are same as these contained by the original object.

Returns:
the copy of this nonleaf-node as a ptree-node.

equals

public boolean equals(ParseTree p)
Tests if this parse-tree-node's value equals to the specified ptree-node's.

Returns:
true if two values are same.

eq

public boolean eq(ParseTree p)
Tests if this parse-tree-node's value equals to the specified ptree-node's.

Returns:
true if two this and p refer to the same ptree object.

toString

public String toString()
Generates string which presents for this parse-tree

Overrides:
toString in class Object
Returns:
string which presents for this parse-tree

writeCode

public void writeCode()
Deprecated.  


toFlattenString

public String toFlattenString()
Generates the string expression from this node. Returned string doesn't have '"' without cancel ( \" ) and doesn't have newline.

This method is useful to embed ptree objects as a string literal in source code.

Returns:
the flatten string which this node represents

getObjectID

public int getObjectID()
Returns the Identifier Number of this object

Returns:
the ID number of this object

accept

public void accept(ParseTreeVisitor visitor)
            throws ParseTreeException
Accepts a 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.

Parameters:
visitor - a visitor
ParseTreeException

childrenAccept

public void childrenAccept(ParseTreeVisitor visitor)
                    throws ParseTreeException
Accepts a 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.

Parameters:
visitor - a visitor
ParseTreeException

SourceForge.net_Logo