|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | 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
Fields inherited from class openjava.ptree.ParseTreeObject |
debugFlag,
debugLevel,
LN,
out,
writerStack |
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(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. |
void |
writeCode()
Overrides the writing code method |
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 |
Constructor Detail |
public CompilationUnit(java.lang.String e0, java.lang.String[] e1, ClassDeclarationList e2)
Method Detail |
public void writeCode()
public void setPackage(java.lang.String qn)
qn
- the qualified name indicating this packagepublic java.lang.String getPackage()
public void setDeclaredImports(java.lang.String[] islst)
islst
- the import statement list of this compilation unitpublic java.lang.String[] getDeclaredImports()
public void setClassDeclarations(ClassDeclarationList tdlst)
tdlst
- the type declaration list of this compilation unitpublic ClassDeclarationList getClassDeclarations()
public ClassDeclaration getPublicClass() throws ParseTreeException
public static boolean isOnDemandImport(java.lang.String import_decl)
java.lang.*
, this returns true, and if
java.lang.Object
, returns false;import_decl
- declared importation.public static java.lang.String trimOnDemand(java.lang.String import_decl)
import_decl
- declared importation.public void accept(ParseTreeVisitor v) throws ParseTreeException
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.
visitor
- a visitor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |