openjava.ptree
Class ClassDeclaration

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

public class ClassDeclaration
extends NonLeaf
implements Statement, MemberDeclaration, ParseTree

The ClassDeclaration class presents class declaraton node of parse tree.

See Also:
ParseTree, NonLeaf, openjava.ptree.TypeDeclaration

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
ClassDeclaration(ModifierList modiflist, java.lang.String name, TypeName[] baseclasses, TypeName[] ifaces, MemberDeclarationList fieldlist)
          Constructs ClassDeclaration from its elements.
ClassDeclaration(ModifierList modiflist, java.lang.String name, TypeName[] baseclasses, TypeName[] ifaces, MemberDeclarationList fieldlist, boolean is_class)
           
 
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.
 TypeName getBaseclass()
          Gets base classes in 'extends' clause.
 TypeName[] getBaseclasses()
          Gets the classes in 'extends' clause.
 MemberDeclarationList getBody()
          Gets class body
 TypeName[] getInterfaces()
          Gets interface name list
 java.lang.String getMetaclass()
           
 ModifierList getModifiers()
          Gets modifier list
 java.lang.String getName()
          Gets the class name.
 java.util.Hashtable getSuffixes()
           
 boolean isInterface()
           
 void setBaseclass(TypeName ctype)
          Sets super class name
 void setBaseclasses(TypeName[] ctypes)
          Sets super class name
 void setBody(MemberDeclarationList mdlist)
          Sets class body
 void setInterfaces(TypeName[] ctlist)
          Sets interface name list
 void setMetaclass(java.lang.String metaclazz)
           
 void setMetaclass(java.lang.String[] metaclazz)
           
 void setModifiers(ModifierList modifs)
          Sets modifier list
 void setName(java.lang.String name)
          Sets a class name in extends clause.
 void setSuffixes(java.util.Hashtable suffixes)
           
 void writeCode()
          write object code ModifierList "class" Identifier "extends" TypeName "implements" TypeNameList MemberDeclarationList
 
Methods inherited from class openjava.ptree.NonLeaf
childrenAccept, elementAt, equals, getComment, getContents, getLength, 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.ParseTree
childrenAccept, eq, equals, getObjectID, makeCopy, makeRecursiveCopy, replace, toFlattenString, toString
 
Methods inherited from interface openjava.ptree.MemberDeclaration
eq, equals
 

Constructor Detail

ClassDeclaration

public ClassDeclaration(ModifierList modiflist,
                        java.lang.String name,
                        TypeName[] baseclasses,
                        TypeName[] ifaces,
                        MemberDeclarationList fieldlist)
Constructs ClassDeclaration from its elements.
Parameters:
modiflist - modifier list
name - class name
zuper - arg zuper is null means class decl has no super class
interfacelist - if class decl has no implemants, arg interfacelist should be set an empty list
fieldlist - field declaration list (body of new class)

ClassDeclaration

public ClassDeclaration(ModifierList modiflist,
                        java.lang.String name,
                        TypeName[] baseclasses,
                        TypeName[] ifaces,
                        MemberDeclarationList fieldlist,
                        boolean is_class)
Method Detail

writeCode

public void writeCode()
write object code ModifierList "class" Identifier "extends" TypeName "implements" TypeNameList MemberDeclarationList
Specified by:
writeCode in interface ParseTree
Overrides:
writeCode in class NonLeaf

isInterface

public boolean isInterface()

getModifiers

public ModifierList getModifiers()
Gets modifier list
Returns:
there is no modifiers, getModifierList returns an empty list.

setModifiers

public void setModifiers(ModifierList modifs)
Sets modifier list
Parameters:
modifs - modifiers to set

getName

public java.lang.String getName()
Gets the class name.
Returns:
class name

setName

public void setName(java.lang.String name)
Sets a class name in extends clause.
Parameters:
name - name to set

getBaseclasses

public TypeName[] getBaseclasses()
Gets the classes in 'extends' clause. This causes
Returns:
if class decl has no extends, this returns null otherwise returns the name of the super class.

getBaseclass

public TypeName getBaseclass()
Gets base classes in 'extends' clause.
Returns:
if class decl has no extends, this returns null otherwise returns the name of the super class.

setBaseclasses

public void setBaseclasses(TypeName[] ctypes)
Sets super class name
Parameters:
ctypes - class types to set

setBaseclass

public void setBaseclass(TypeName ctype)
Sets super class name
Parameters:
ctype - class type to set

getInterfaces

public TypeName[] getInterfaces()
Gets interface name list
Returns:
there is no implemented class, getInterfaceList returns an empty list

setInterfaces

public void setInterfaces(TypeName[] ctlist)
Sets interface name list
Parameters:
ctlist - class type list to set

getBody

public MemberDeclarationList getBody()
Gets class body
Returns:
return an field declaration list as this class body.

setBody

public void setBody(MemberDeclarationList mdlist)
Sets class body
Parameters:
body - member declaration list to set as this class body.

setSuffixes

public void setSuffixes(java.util.Hashtable suffixes)

getSuffixes

public java.util.Hashtable getSuffixes()

setMetaclass

public void setMetaclass(java.lang.String metaclazz)

setMetaclass

public void setMetaclass(java.lang.String[] metaclazz)

getMetaclass

public java.lang.String getMetaclass()

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
Overrides:
accept in class ParseTreeObject
Following copied from interface: openjava.ptree.ParseTree
Parameters:
visitor - a visitor