openjava.ptree
Class List

java.lang.Object
  |
  +--openjava.ptree.ParseTreeObject
        |
        +--openjava.ptree.List
All Implemented Interfaces:
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.


Field Summary
private  Vector contents
          The ptreelist the list of parse-tree nodes
private  String delimiter
           
 
Fields inherited from class openjava.ptree.ParseTreeObject
debugFlag, debugLevel, LN, out, writerStack
 
Constructor Summary
protected List()
          Allocates this List
protected List(Object p)
          Allocates this List
protected List(String delimiter)
          Allocates this List
protected List(String delimiter, 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.
 boolean contains(String str)
          Tests if any element representing the specified string is exist or not.
protected  void contents_addElement(Object obj)
           
protected  Object contents_elementAt(int index)
           
protected  void contents_insertElementAt(Object obj, int index)
           
protected  void contents_removeElementAt(int index)
           
protected  void contents_setElementAt(Object obj, int index)
           
protected  int contents_size()
           
 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
 

Field Detail

contents

private Vector contents
The ptreelist the list of parse-tree nodes


delimiter

private String delimiter
Constructor Detail

List

protected List()
Allocates this List


List

protected List(Object p)
Allocates this List


List

protected List(String delimiter)
Allocates this List


List

protected List(String delimiter,
               Object p)
Allocates this List

Method Detail

replaceChildWith

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

contents_addElement

protected void contents_addElement(Object obj)

contents_insertElementAt

protected void contents_insertElementAt(Object obj,
                                        int index)

contents_setElementAt

protected void contents_setElementAt(Object obj,
                                     int index)

contents_elementAt

protected Object contents_elementAt(int index)

contents_removeElementAt

protected void contents_removeElementAt(int index)

contents_size

protected int contents_size()

elements

public 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


contains

public boolean contains(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
Specified by:
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
Specified by:
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
Specified by:
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
Specified by:
childrenAccept in class ParseTreeObject
Parameters:
visitor - a visitor
ParseTreeException

SourceForge.net_Logo