|
||||||||||
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.ForStatement
The ForStatement
class represents a for statement
node of parse tree.
The specification of the initialization part may be modified
in the later version of OpenJava.
ParseTree
,
NonLeaf
,
Statement
,
Expression
,
ExpressionList
,
StatementList
Field Summary |
Fields inherited from class openjava.ptree.NonLeaf |
|
Fields inherited from class openjava.ptree.ParseTreeObject |
debugFlag, debugLevel, LN, out, writerStack |
Constructor Summary | |
(package private) |
ForStatement()
Allocates a new ForStatement object. |
|
ForStatement(ExpressionList init,
Expression expr,
ExpressionList iterator,
StatementList stmts)
Allocates a new ForStatement object. |
|
ForStatement(String varName,
Expression query,
StatementList stmts)
Allocates a new ForStatement object of the form for (variable in
query) … . |
|
ForStatement(TypeName tspec,
VariableDeclarator[] vdecls,
Expression expr,
ExpressionList iterator,
StatementList stmts)
|
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. |
Expression |
getCondition()
Gets the condition part of this for-statement. |
ExpressionList |
getIncrement()
Gets the increments part of this for-statement. |
ExpressionList |
getInit()
Gets the initialization part of this for-statement. |
VariableDeclarator[] |
getInitDecls()
Gets the initialization part of this for-statement. |
TypeName |
getInitDeclType()
Gets the initialization part of this for-statement. |
Expression |
getQuery()
Gets the 'in' expression of this for-statement. |
StatementList |
getStatements()
Gets the body of this for-statement. |
String |
getVariable()
Gets the name of the 'in' variable in a for-statement. |
void |
setCondition(Expression cond)
Sets the condition part of this for-statement. |
void |
setIncrement(ExpressionList incs)
Sets the increments part of this for-statement. |
void |
setInit(ExpressionList init)
Sets the initialization part of this for-statement. |
void |
setInitDecl(TypeName type_specifier,
VariableDeclarator[] init)
Sets the initialization part of this for-statement. |
void |
setQuery(Expression query)
Sets the 'in' expression of this for-statement. |
void |
setStatements(StatementList stmts)
Sets the body of this for-statement. |
void |
setVariable(String name)
Sets the name of the 'in' variable of this for-statement. |
void |
writeCode()
Writes the code this parse-tree presents for. |
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 |
Constructor Detail |
ForStatement()
public ForStatement(ExpressionList init, Expression expr, ExpressionList iterator, StatementList stmts)
init
- the initialization part.expr
- the condition part.iterator
- the increments part.stmts
- the stement list of the body.public ForStatement(TypeName tspec, VariableDeclarator[] vdecls, Expression expr, ExpressionList iterator, StatementList stmts)
public ForStatement(String varName, Expression query, StatementList stmts)
for (variable in
query) …
.
varName
- name of variablequery
- query expressionstmts
- the statement list of the bodyMethod Detail |
public void writeCode()
NonLeaf
writeCode
in interface ParseTree
writeCode
in class NonLeaf
public ExpressionList getInit()
public void setInit(ExpressionList init)
init
- the initialization part.public TypeName getInitDeclType()
public VariableDeclarator[] getInitDecls()
public void setInitDecl(TypeName type_specifier, VariableDeclarator[] init)
init
- the initialization part.public Expression getCondition()
public void setCondition(Expression cond)
cond
- the expression of the condtion part.public ExpressionList getIncrement()
public void setIncrement(ExpressionList incs)
incs
- the expression list of the increments part.public StatementList getStatements()
public void setStatements(StatementList stmts)
stmts
- the statement list of the body.public String getVariable()
public void setVariable(String name)
public Expression getQuery()
public void setQuery(Expression query)
query
- the 'in' expression.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 |