All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class openjava.ptree.CompilationUnit

java.lang.Object
   |
   +----openjava.ptree.PtreeObject
           |
           +----openjava.ptree.NonLeaf
                   |
                   +----openjava.ptree.CompilationUnit

public class CompilationUnit
extends NonLeaf
The CompilationUnit class presents for the whole parse tree in a file. CompilationUnits consists of (package statement) (import statement list) (type declaration list) QualifiedName ImportStatementList TypeDeclarationList

See Also:
QualifiedName, ImportStatementList, TypeDeclarationList

Constructor Index

 o CompilationUnit(QualifiedName, ImportStatementList, TypeDeclarationList)
Allocates this object with specified parse-tree elements.

Method Index

 o getImportStatements()
Obtains the import statement list of this compilation unit
 o getPackage()
Obtains the package of this compilation unit
 o getPublicClass()
Obtains the public class in this compilation unit.
 o getTypeDeclarations()
Obtains the type declaration list of this compilation unit
 o setImportStatements(ImportStatementList)
Sets the import statement list of this compilation unit
 o setPackage(QualifiedName)
Sets the package of this compilation unit
 o setTypeDeclarations(TypeDeclarationList)
Sets the type declaration list of this compilation unit
 o writeCode()
Overrides the writing code method

Constructors

 o CompilationUnit
 public CompilationUnit(QualifiedName e0,
                        ImportStatementList e1,
                        TypeDeclarationList e2)
Allocates this object with specified parse-tree elements.

Methods

 o writeCode
 public void writeCode()
Overrides the writing code method

Overrides:
writeCode in class NonLeaf
 o setPackage
 public void setPackage(QualifiedName qn)
Sets the package of this compilation unit

Parameters:
qn - the qualified name indicating this package
 o getPackage
 public QualifiedName getPackage()
Obtains the package of this compilation unit

Returns:
the qualified name indicating this package
 o setImportStatements
 public void setImportStatements(ImportStatementList islst)
Sets the import statement list of this compilation unit

Parameters:
islst - the import statement list of this compilation unit
 o getImportStatements
 public ImportStatementList getImportStatements()
Obtains the import statement list of this compilation unit

Returns:
the import statement list of this compilation unit
 o setTypeDeclarations
 public void setTypeDeclarations(TypeDeclarationList tdlst)
Sets the type declaration list of this compilation unit

Parameters:
tdlst - the type declaration list of this compilation unit
 o getTypeDeclarations
 public TypeDeclarationList getTypeDeclarations()
Obtains the type declaration list of this compilation unit

Returns:
the type declaration list of this compilation unit
 o getPublicClass
 public TypeDeclaration getPublicClass() throws PtreeException
Obtains the public class in this compilation unit.

Returns:
the public class
Throws: PtreeException
if not one public class is declared.

All Packages  Class Hierarchy  This Package  Previous  Next  Index