openjava.ptree
Class List

java.lang.Object
  |
  +--openjava.ptree.ParseTreeObject
        |
        +--openjava.ptree.List
All Implemented Interfaces:
java.lang.Cloneable, ParseTree
Direct Known Subclasses:
ArrayInitializer, CaseGroupList, CaseLabelList, CatchList, ClassDeclarationList, ExpressionList, MemberDeclarationList, ModifierList, ObjectList, ParameterList, StatementList

public abstract class List
extends ParseTreeObject
implements ParseTree

The List class presents for the list of parse trees.


Fields inherited from class openjava.ptree.ParseTreeObject
debugFlag, debugLevel, LN, out, writerStack
 
Constructor Summary
protected List()
          Allocates this List
protected List(java.lang.Object p)
          Allocates this List
protected List(java.lang.String delimiter)
          Allocates this List
protected List(java.lang.String delimiter, java.lang.Object p)
          Allocates this List
 
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. This invoke an appropriate visit() method on each child ParseTree object with this visitor.
 boolean contains(java.lang.String str)
          Tests if any element representing the specified string is exist or not.
protected  void contents_addElement(java.lang.Object obj)
           
protected  java.lang.Object contents_elementAt(int index)
           
protected  void contents_insertElementAt(java.lang.Object obj, int index)
           
protected  void contents_removeElementAt(int index)
           
protected  void contents_setElementAt(java.lang.Object obj, int index)
           
protected  int contents_size()
           
 java.util.Enumeration elements()
          Get contents
 boolean equals(ParseTree p)
          Tests if this list-node's value equals to the specified ptree-node's.
 boolean isEmpty()
          Tests if this list is empty.
 ParseTree makeRecursiveCopy()
          Makes a new copy (another object) of this list-node.
 void removeAll()
          Removes an element at the specified point from this list
protected  void replaceChildWith(ParseTree dist, ParseTree replacement)
           
 int size()
          Returns the length of this list.
 void writeCode()
          Writes the code this parse-tree presents for.
 
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
 

Constructor Detail

List

protected List()
Allocates this List

List

protected List(java.lang.Object p)
Allocates this List
Parameters:
p0 - list's element

List

protected List(java.lang.String delimiter)
Allocates this List

List

protected List(java.lang.String delimiter,
               java.lang.Object p)
Allocates this List
Parameters:
p0 - list's element
Method Detail

replaceChildWith

protected final void replaceChildWith(ParseTree dist,
                                      ParseTree replacement)
                               throws ParseTreeException
Overrides:
replaceChildWith in class ParseTreeObject

contents_addElement

protected void contents_addElement(java.lang.Object obj)

contents_insertElementAt

protected void contents_insertElementAt(java.lang.Object obj,
                                        int index)

contents_setElementAt

protected void contents_setElementAt(java.lang.Object obj,
                                     int index)

contents_elementAt

protected java.lang.Object contents_elementAt(int index)

contents_removeElementAt

protected void contents_removeElementAt(int index)

contents_size

protected int contents_size()

elements

public java.util.Enumeration elements()
Get contents

size

public int size()
Returns the length of this list.
Returns:
the length of this list

isEmpty

public boolean isEmpty()
Tests if this list is empty.
Returns:
true if this list is empty

removeAll

public void removeAll()
Removes an element at the specified point from this list
Parameters:
n - where to remove element.

contains

public boolean contains(java.lang.String str)
Tests if any element representing the specified string is exist or not.
Parameters:
str - a string to test.
Returns:
true if any element representing the specified string is exist.

equals

public boolean equals(ParseTree p)
Tests if this list-node's value equals to the specified ptree-node's.
Specified by:
equals in interface ParseTree
Overrides:
equals in class ParseTreeObject
Returns:
true if two values are same.

makeRecursiveCopy

public ParseTree makeRecursiveCopy()
Makes a new copy (another object) of this list-node. The objects contained by this object will also be copied
Specified by:
makeRecursiveCopy in interface ParseTree
Overrides:
makeRecursiveCopy in class ParseTreeObject
Returns:
the copy of this nonleaf-node as a ptree-node.

writeCode

public void writeCode()
Writes the code this parse-tree presents for.
Specified by:
writeCode in interface ParseTree
Overrides:
writeCode in class ParseTreeObject

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
Overrides:
childrenAccept in class ParseTreeObject
Parameters:
visitor - a visitor