openjava.ptree
Class NonLeaf

java.lang.Object
  |
  +--openjava.ptree.ParseTreeObject
        |
        +--openjava.ptree.NonLeaf
All Implemented Interfaces:
Cloneable, ParseTree
Direct Known Subclasses:
AliasedExpression, AllocationExpression, ArrayAccess, ArrayAllocationExpression, AssignmentExpression, BinaryExpression, Block, BreakStatement, CaseGroup, CaseLabel, CastExpression, CatchBlock, ClassDeclaration, ClassLiteral, CompilationUnit, ConditionalExpression, ConstructorDeclaration, ConstructorInvocation, ContinueStatement, DoWhileStatement, EmptyStatement, ExpressionObject, ExpressionStatement, FieldAccess, FieldDeclaration, ForStatement, IfStatement, InstanceofExpression, LabeledStatement, MemberInitializer, MethodCall, MethodDeclaration, Parameter, ReturnStatement, SetExpression, SwitchStatement, SynchronizedStatement, ThrowStatement, TryStatement, TypeName, UnaryExpression, VariableDeclaration, VariableDeclarator, WhileStatement

public abstract class NonLeaf
extends ParseTreeObject
implements ParseTree

The NonLeaf class presents for node of parse tree.

See Also:
ParseTree, Leaf

Field Summary
private  String comment
           
private  Object[] contents
          contents is the array of the elements of this nonleaf-node.
 
Fields inherited from class openjava.ptree.ParseTreeObject
debugFlag, debugLevel, LN, out, writerStack
 
Constructor Summary
NonLeaf()
          Allocates a new non-leaf(cons-cell), where the first element has null and the second element has null.
 
Method Summary
 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  boolean childrenAreEqual(NonLeaf p)
          Returns whether all of this object's children are equal to the corresponding child of other
protected  Object elementAt(int i)
          Returns the specified element at the specified point of this nonleaf-node.
 boolean equals(ParseTree p)
          Tests if this nonleaf-node's value equals to the specified ptree-node's.
 String getComment()
          Obtains the comment of javadoc format which explains this declaration.
 Object[] getContents()
          Gets the contents of this nonleaf-node.
protected  int getLength()
          getLength() returns the length of this nonleaf-node
 OJClass getRowType(Environment env)
           
 ParseTree makeRecursiveCopy()
          Makes a new copy (another object) of this nonleaf-node recursively.
protected  void replaceChildWith(ParseTree dist, ParseTree replacement)
           
protected  void set(Object p)
          Makes this ptree a list presenting for [ p ]
protected  void set(Object[] ptrees)
          Makes this ptree a list presenting for [ p ]
protected  void set(Object p0, Object p1)
          Makes this ptree a list presenting for [ p0 p1 ]
protected  void set(Object p0, Object p1, Object p2)
          Makes this ptree a list presenting for [ p0 p1 p2 ]
protected  void set(Object p0, Object p1, Object p2, Object p3)
          Makes this ptree a list presenting for [ p0 p1 p2 p3 ]
protected  void set(Object p0, Object p1, Object p2, Object p3, Object p4)
          Makes this ptree a list presenting for [ p0 p1 p2 p3 p4 ]
protected  void set(Object p0, Object p1, Object p2, Object p3, Object p4, Object p5)
          Makes this ptree a list presenting for [ p0 p1 p2 p3 p4 p5 ]
protected  void set(Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6)
          Makes this ptree a list presenting for [ p0 p1 p2 p3 p4 p5 p6 ]
protected  void set(Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7)
          Makes this ptree a list presenting for [ p0 p1 p2 p3 p4 p5 p6 p7 ]
 void setComment(String comment)
          Sets the comment of javadoc format which explains this declaration.
protected  void setElementAt(Object p, int i)
          Sets the specified element at the specified point of this nonleaf-node.
 void writeCode()
          Deprecated.  
 
Methods inherited from class openjava.ptree.ParseTreeObject
accept, clone, eq, eq, equal, flushPrintWriter, getDebugFlag, getNest, getObjectID, getParent, getPrintWriter, getTab, hashCode, lastObjectID, makeCopy, popNest, popPrintWriter, pushNest, pushPrintWriter, replace, setDebugFlag, setDebugLevel, setNest, setParent, setPrintStream, setTab, toFlattenString, toString, 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
accept, eq, getObjectID, makeCopy, replace, toFlattenString, toString
 

Field Detail

comment

private String comment

contents

private Object[] contents
contents is the array of the elements of this nonleaf-node.

Constructor Detail

NonLeaf

public NonLeaf()
Allocates a new non-leaf(cons-cell), where the first element has null and the second element has null.

Method Detail

replaceChildWith

protected final void replaceChildWith(ParseTree dist,
                                      ParseTree replacement)
                               throws ParseTreeException
Specified by:
replaceChildWith in class ParseTreeObject
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.

Specified by:
makeRecursiveCopy in interface ParseTree
Specified by:
makeRecursiveCopy in class ParseTreeObject
Returns:
the copy of this nonleaf-node as a ptree-node.

equals

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

Specified by:
equals in interface ParseTree
Specified by:
equals in class ParseTreeObject
Returns:
true if two values are same.

childrenAreEqual

protected boolean childrenAreEqual(NonLeaf p)
Returns whether all of this object's children are equal to the corresponding child of other


set

protected void set(Object[] ptrees)
Makes this ptree a list presenting for [ p ]

Parameters:
ptrees - list's element

set

protected void set(Object p)
Makes this ptree a list presenting for [ p ]

Parameters:
p - list's element

set

protected void set(Object p0,
                   Object p1)
Makes this ptree a list presenting for [ p0 p1 ]

Parameters:
p0 - list's element
p1 - list's element

set

protected void set(Object p0,
                   Object p1,
                   Object p2)
Makes this ptree a list presenting for [ p0 p1 p2 ]

Parameters:
p0 - list's element
p1 - list's element
p2 - list's element

set

protected void set(Object p0,
                   Object p1,
                   Object p2,
                   Object p3)
Makes this ptree a list presenting for [ p0 p1 p2 p3 ]

Parameters:
p0 - list's element
p1 - list's element
p2 - list's element
p3 - list's element

set

protected void set(Object p0,
                   Object p1,
                   Object p2,
                   Object p3,
                   Object p4)
Makes this ptree a list presenting for [ p0 p1 p2 p3 p4 ]

Parameters:
p0 - list's element
p1 - list's element
p2 - list's element
p3 - list's element
p4 - list's element

set

protected void set(Object p0,
                   Object p1,
                   Object p2,
                   Object p3,
                   Object p4,
                   Object p5)
Makes this ptree a list presenting for [ p0 p1 p2 p3 p4 p5 ]

Parameters:
p0 - list's element
p1 - list's element
p2 - list's element
p3 - list's element
p4 - list's element

set

protected void set(Object p0,
                   Object p1,
                   Object p2,
                   Object p3,
                   Object p4,
                   Object p5,
                   Object p6)
Makes this ptree a list presenting for [ p0 p1 p2 p3 p4 p5 p6 ]

Parameters:
p0 - list's element
p1 - list's element
p2 - list's element
p3 - list's element
p4 - list's element
p5 - list's element
p6 - list's element

set

protected void set(Object p0,
                   Object p1,
                   Object p2,
                   Object p3,
                   Object p4,
                   Object p5,
                   Object p6,
                   Object p7)
Makes this ptree a list presenting for [ p0 p1 p2 p3 p4 p5 p6 p7 ]

Parameters:
p0 - list's element
p1 - list's element
p2 - list's element
p3 - list's element
p4 - list's element
p5 - list's element
p6 - list's element
p7 - list's element

writeCode

public void writeCode()
Deprecated.  

Writes the code this parse-tree presents for.

Specified by:
writeCode in interface ParseTree
Specified by:
writeCode in class ParseTreeObject

elementAt

protected Object elementAt(int i)
Returns the specified element at the specified point of this nonleaf-node.

Parameters:
i - index
Returns:
the ptree object at the specified point

setElementAt

protected void setElementAt(Object p,
                            int i)
Sets the specified element at the specified point of this nonleaf-node.

Parameters:
p - ptree object to set
i - index

getContents

public Object[] getContents()
Gets the contents of this nonleaf-node.

Returns:
contents

getLength

protected int getLength()
getLength() returns the length of this nonleaf-node

Returns:
the length of the list

setComment

public void setComment(String comment)
Sets the comment of javadoc format which explains this declaration.

Parameters:
comment - the Comment object to set

getComment

public String getComment()
Obtains the comment of javadoc format which explains this declaration.

Returns:
the string of the comment

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.

Specified by:
childrenAccept in interface ParseTree
Specified by:
childrenAccept in class ParseTreeObject
Parameters:
visitor - a visitor
ParseTreeException

getRowType

public OJClass getRowType(Environment env)
                   throws Exception
Exception

SourceForge.net_Logo