openjava.ptree
Class ClassDeclaration

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

public class ClassDeclaration
extends NonLeaf
implements Statement, MemberDeclaration, ParseTree

The ClassDeclaration class presents class declaration node of parse tree.

See Also:
ParseTree, NonLeaf

Field Summary
private  boolean _isInterface
           
private  String[] metaclazz
           
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
ClassDeclaration(ModifierList modiflist, String name, TypeName[] baseclasses, TypeName[] ifaces, MemberDeclarationList fieldlist)
          Constructs ClassDeclaration from its elements.
ClassDeclaration(ModifierList modiflist, 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
 String getMetaclass()
           
 ModifierList getModifiers()
          Gets modifier list
 String getName()
          Gets the class name.
 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(String metaclazz)
           
 void setMetaclass(String[] metaclazz)
           
 void setModifiers(ModifierList modifs)
          Sets modifier list
 void setName(String name)
          Sets a class name in extends clause.
 void setSuffixes(Hashtable suffixes)
           
 void writeCode()
          write object code ModifierList "class" Identifier "extends" TypeName "implements" TypeNameList MemberDeclarationList
 
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.ParseTree
childrenAccept, eq, equals, getObjectID, makeCopy, makeRecursiveCopy, replace, toFlattenString, toString
 
Methods inherited from interface openjava.ptree.MemberDeclaration
eq, equals
 

Field Detail

metaclazz

private String[] metaclazz

suffixes

private Hashtable suffixes

_isInterface

private boolean _isInterface
Constructor Detail

ClassDeclaration

public ClassDeclaration(ModifierList modiflist,
                        String name,
                        TypeName[] baseclasses,
                        TypeName[] ifaces,
                        MemberDeclarationList fieldlist)
Constructs ClassDeclaration from its elements.

Parameters:
modiflist - modifier list
name - class name
fieldlist - field declaration list (body of new class)

ClassDeclaration

public ClassDeclaration(ModifierList modiflist,
                        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 String getName()
Gets the class name.

Returns:
class name

setName

public void setName(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


setSuffixes

public void setSuffixes(Hashtable suffixes)

getSuffixes

public Hashtable getSuffixes()

setMetaclass

public void setMetaclass(String metaclazz)

setMetaclass

public void setMetaclass(String[] metaclazz)

getMetaclass

public 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
Specified by:
accept in class ParseTreeObject
Parameters:
v - a visitor
ParseTreeException

SourceForge.net_Logo