Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

openjava.ptree
Class CompilationUnit  view CompilationUnit download CompilationUnit.java

java.lang.Object
  extended byopenjava.ptree.ParseTreeObject
      extended byopenjava.ptree.NonLeaf
          extended byopenjava.ptree.CompilationUnit
All Implemented Interfaces:
java.lang.Cloneable, ParseTree

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 ClassDeclarationList


Field Summary
 
Fields inherited from class openjava.ptree.NonLeaf
 
Fields inherited from class openjava.ptree.ParseTreeObject
LN
 
Constructor Summary
CompilationUnit(java.lang.String e0, java.lang.String[] e1, ClassDeclarationList e2)
          Allocates this object with specified parse-tree elements.
 
Method Summary
 void accept(openjava.ptree.util.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.
 ClassDeclarationList getClassDeclarations()
          Obtains the type declaration list of this compilation unit
 java.lang.String[] getDeclaredImports()
          Obtains the import statement list of this compilation unit
 java.lang.String getPackage()
          Obtains the package of this compilation unit
 ClassDeclaration getPublicClass()
          Obtains the public class in this compilation unit.
static boolean isOnDemandImport(java.lang.String import_decl)
          Tests if the declared import string represents on demand importation.
 void setClassDeclarations(ClassDeclarationList tdlst)
          Sets the type declaration list of this compilation unit
 void setDeclaredImports(java.lang.String[] islst)
          Sets the import statement list of this compilation unit
 void setPackage(java.lang.String qn)
          Sets the package of this compilation unit
static java.lang.String trimOnDemand(java.lang.String import_decl)
          Removes ".*" at tail if it exists.
 
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, equal, getObjectID, getParent, hashCode, lastObjectID, makeCopy, replace, setParent, toFlattenString, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface openjava.ptree.ParseTree
getObjectID, makeCopy, replace, toFlattenString, toString
 

Constructor Detail

CompilationUnit

public CompilationUnit(java.lang.String e0,
                       java.lang.String[] e1,
                       ClassDeclarationList e2)
Allocates this object with specified parse-tree elements.

Method Detail

setPackage

public void setPackage(java.lang.String qn)
Sets the package of this compilation unit


getPackage

public java.lang.String getPackage()
Obtains the package of this compilation unit


setDeclaredImports

public void setDeclaredImports(java.lang.String[] islst)
Sets the import statement list of this compilation unit


getDeclaredImports

public java.lang.String[] getDeclaredImports()
Obtains the import statement list of this compilation unit


setClassDeclarations

public void setClassDeclarations(ClassDeclarationList tdlst)
Sets the type declaration list of this compilation unit


getClassDeclarations

public ClassDeclarationList getClassDeclarations()
Obtains the type declaration list of this compilation unit


getPublicClass

public ClassDeclaration getPublicClass()
                                throws ParseTreeException
Obtains the public class in this compilation unit.


isOnDemandImport

public static boolean isOnDemandImport(java.lang.String import_decl)
Tests if the declared import string represents on demand importation. For example, if the specified string is java.lang.*, this returns true, and if java.lang.Object, returns false;


trimOnDemand

public static java.lang.String trimOnDemand(java.lang.String import_decl)
Removes ".*" at tail if it exists.


accept

public void accept(openjava.ptree.util.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