openjava.ptree
Class ConstructorDeclaration

java.lang.Object
  |
  +--openjava.ptree.ParseTreeObject
        |
        +--openjava.ptree.NonLeaf
              |
              +--openjava.ptree.ConstructorDeclaration
All Implemented Interfaces:
Cloneable, MemberDeclaration, ParseTree

public class ConstructorDeclaration
extends NonLeaf
implements MemberDeclaration

The ConstructorDeclaration class represents constructor declaration node of the parse tree.

See Also:
NonLeaf, MemberDeclaration, ModifierList, ParameterList, TypeName, ConstructorInvocation, StatementList

Field Summary
private  Hashtable suffixes
           
 
Fields inherited from class openjava.ptree.NonLeaf
 
Fields inherited from class openjava.ptree.ParseTreeObject
debugFlag, debugLevel, LN, out, writerStack
 
Fields inherited from interface openjava.ptree.MemberDeclaration
CONSTRUCTOR, FIELD, METHOD, STATICINIT, STATICINITIALIZER, TYPE
 
Constructor Summary
(package private) ConstructorDeclaration()
          for recursive copy
  ConstructorDeclaration(ModifierList modiflist, String name, ParameterList params, TypeName[] throwlist, ConstructorInvocation scstmt, StatementList stmtlist)
          Constructs new ConstructorDeclaration from its elements.
  ConstructorDeclaration(ModifierList modiflist, String name, ParameterList params, TypeName[] throwlist, StatementList stmtlist)
          Constructs new ConstructorDeclaration from its elements.
 
Method Summary
 void accept(ParseTreeVisitor v)
          Accepts a ParseTreeVisitor object as the role of a Visitor in the Visitor pattern, as the role of an Element in the Visitor pattern.
 StatementList getBody()
          Gets the statement list of this constructor body.
 ConstructorInvocation getConstructorInvocation()
          Gets the special call statement.
 ModifierList getModifiers()
          Gets modifier list.
 String getName()
          Gets the name of this constructor node.
 ParameterList getParameters()
          Gets the parameter list.
 Hashtable getSuffixes()
           
 TypeName[] getThrows()
          Gets the class type list thrown by this constructor.
 void setBody(StatementList stmts)
          Sets the statement list of this constructor body.
 void setConstructorInvocation(ConstructorInvocation scstmt)
          Sets the special call statement.
 void setModifiers(ModifierList modifs)
          Sets modifier list.
 void setName(String name)
          Sets the name of this constructor node.
 void setParameters(ParameterList params)
          Sets the parameter list.
 void setSuffixes(Hashtable suffixes)
           
 void setThrows(TypeName[] ctlist)
          Sets the class type list thrown by this constructor.
 void writeCode()
          Writes the code this parse-tree presents for.
 
Methods inherited from class openjava.ptree.NonLeaf
childrenAccept, childrenAreEqual, elementAt, equals, getComment, getContents, getLength, getRowType, makeRecursiveCopy, replaceChildWith, set, set, set, set, set, set, set, set, set, setComment, setElementAt
 
Methods inherited from class openjava.ptree.ParseTreeObject
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.MemberDeclaration
eq, equals
 
Methods inherited from interface openjava.ptree.ParseTree
childrenAccept, getObjectID, makeCopy, makeRecursiveCopy, replace, toFlattenString, toString
 

Field Detail

suffixes

private Hashtable suffixes
Constructor Detail

ConstructorDeclaration

public ConstructorDeclaration(ModifierList modiflist,
                              String name,
                              ParameterList params,
                              TypeName[] throwlist,
                              ConstructorInvocation scstmt,
                              StatementList stmtlist)
Constructs new ConstructorDeclaration from its elements.

Parameters:
modiflist - modifier list, if it has no modifier list then thes arg is set empty list.
name - name of this constructor.
params - parameter list
throwlist - throw type list, if there is no throws then this arg is set empty list
scstmt - statement which calls another constructor if this is null, it means no another constructor call exists.
stmtlist - statement list of this constructor body. if this is null, it means method body is with only semi colon.

ConstructorDeclaration

public ConstructorDeclaration(ModifierList modiflist,
                              String name,
                              ParameterList params,
                              TypeName[] throwlist,
                              StatementList stmtlist)
Constructs new ConstructorDeclaration from its elements.

Parameters:
modiflist - modifier list, if it has no modifier list then thes arg is set empty list.
name - name of this constructor.
params - parameter list
throwlist - throw type list, if there is no throws then this arg is set empty list
stmtlist - statement list of this constructor body. if this is null, it means method body is with only semi colon.

ConstructorDeclaration

ConstructorDeclaration()
for recursive copy

Method Detail

writeCode

public void writeCode()
Description copied from class: NonLeaf
Writes the code this parse-tree presents for.

Specified by:
writeCode in interface MemberDeclaration
Overrides:
writeCode in class NonLeaf

getModifiers

public ModifierList getModifiers()
Gets modifier list.

Returns:
modifier list.

setModifiers

public void setModifiers(ModifierList modifs)
Sets modifier list.

Parameters:
modifs - modifier list.

getName

public String getName()
Gets the name of this constructor node.

Returns:
constructor declarator node.

setName

public void setName(String name)
Sets the name of this constructor node.

Parameters:
name - the name to be set.

getParameters

public ParameterList getParameters()
Gets the parameter list.

Returns:
parameter list for constructor.

setParameters

public void setParameters(ParameterList params)
Sets the parameter list.

Parameters:
params - parameterlist for constructor declarator node.

getThrows

public TypeName[] getThrows()
Gets the class type list thrown by this constructor.

Returns:
class type list thrown by this constructor.

setThrows

public void setThrows(TypeName[] ctlist)
Sets the class type list thrown by this constructor.

Parameters:
ctlist - class type list thrown by this constructor.

getConstructorInvocation

public ConstructorInvocation getConstructorInvocation()
Gets the special call statement. Special call statement is like:
     super();
 

Returns:
special call statement

setConstructorInvocation

public void setConstructorInvocation(ConstructorInvocation scstmt)
Sets the special call statement.

Parameters:
scstmt - the special call statement to set
See Also:
getConstructorInvocation()

getBody

public StatementList getBody()
Gets the statement list of this constructor body.

Returns:
the statement list of this constructor body.

setBody

public void setBody(StatementList stmts)
Sets the statement list of this constructor body.

Returns:
the statement list of this constructor body.

setSuffixes

public void setSuffixes(Hashtable suffixes)

getSuffixes

public Hashtable getSuffixes()

accept

public void accept(ParseTreeVisitor v)
            throws ParseTreeException
Description copied from interface: ParseTree
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.

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

SourceForge.net_Logo