|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--openjava.ptree.ParseTreeObject | +--openjava.ptree.NonLeaf | +--openjava.ptree.CompilationUnit
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
ClassDeclarationList
Field Summary |
Fields inherited from class openjava.ptree.NonLeaf |
|
Fields inherited from class openjava.ptree.ParseTreeObject |
debugFlag, debugLevel, LN, out, writerStack |
Constructor Summary | |
CompilationUnit(String e0,
String[] e1,
ClassDeclarationList e2)
Allocates this object with specified parse-tree 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. |
ClassDeclarationList |
getClassDeclarations()
Obtains the type declaration list of this compilation unit |
String[] |
getDeclaredImports()
Obtains the import statement list of this compilation unit |
String |
getPackage()
Obtains the package of this compilation unit |
ClassDeclaration |
getPublicClass()
Obtains the public class in this compilation unit. |
static boolean |
isOnDemandImport(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(String[] islst)
Sets the import statement list of this compilation unit |
void |
setPackage(String qn)
Sets the package of this compilation unit |
static String |
trimOnDemand(String import_decl)
Removes ".*" at tail if it exists. |
void |
writeCode()
Overrides the writing code method |
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 |
eq, getObjectID, makeCopy, replace, toFlattenString, toString |
Constructor Detail |
public CompilationUnit(String e0, String[] e1, ClassDeclarationList e2)
Method Detail |
public void writeCode()
writeCode
in interface ParseTree
writeCode
in class NonLeaf
public void setPackage(String qn)
qn
- the qualified name indicating this packagepublic String getPackage()
public void setDeclaredImports(String[] islst)
islst
- the import statement list of this compilation unitpublic String[] getDeclaredImports()
public void setClassDeclarations(ClassDeclarationList tdlst)
tdlst
- the type declaration list of this compilation unitpublic ClassDeclarationList getClassDeclarations()
public ClassDeclaration getPublicClass() throws ParseTreeException
ParseTreeException
- if not one public class is declared.public static boolean isOnDemandImport(String import_decl)
java.lang.*
, this returns true, and if
java.lang.Object
, returns false;
import_decl
- declared importation.
public static String trimOnDemand(String import_decl)
import_decl
- declared importation.
public void accept(ParseTreeVisitor v) throws ParseTreeException
ParseTree
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.
accept
in interface ParseTree
accept
in class ParseTreeObject
v
- a visitor
ParseTreeException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |