|
|||||||||
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.IfStatement
The IfStatement
class represents a if statement node
of parse tree
ParseTree
,
NonLeaf
,
Statement
,
Expression
,
StatementList
Fields inherited from class openjava.ptree.ParseTreeObject |
debugFlag,
debugLevel,
LN,
out,
writerStack |
Constructor Summary | |
IfStatement(Expression expr,
StatementList stmts)
Constructs new IfStatement from prototype object |
|
IfStatement(Expression expr,
StatementList stmts,
StatementList elsestmts)
Constructs new IfStatement from prototype object |
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. |
StatementList |
getElseStatements()
Gets the else part of this if statement. |
Expression |
getExpression()
Gets the condition of this if statement. |
StatementList |
getStatements()
Gets the then part of this if statement. |
void |
setElseStatements(StatementList elsestmts)
Sets the else part of this if statement. |
void |
setExpression(Expression expr)
Sets the condition of this if statement. |
void |
setStatements(StatementList thenstmts)
Sets the then part of this if statement. |
void |
writeCode()
Writes the code this parse-tree presents for. |
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 IfStatement(Expression expr, StatementList stmts, StatementList elsestmts)
expr
- the condition of this if statement.stmts
- the statement that is executed when expr is tureelsestmts
- the statement that is executed when expr is false.
If there is no else part then statement list is
empty.public IfStatement(Expression expr, StatementList stmts)
expr
- the condition of this if statement.stmts
- the statement that is executed when expr is tureMethod Detail |
public void writeCode()
public Expression getExpression()
public void setExpression(Expression expr)
expr
- the expression of the condition.public StatementList getStatements()
public void setStatements(StatementList thenstmts)
thenstmts
- the statement list of the then part.public StatementList getElseStatements()
public void setElseStatements(StatementList elsestmts)
elsestmts
- the statement list of the else part.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 |