All Packages Class Hierarchy This Package Previous Next Index
Class openjava.ptree.IfStatement
java.lang.Object
|
+----openjava.ptree.PtreeObject
|
+----openjava.ptree.NonLeaf
|
+----openjava.ptree.IfStatement
- public class IfStatement
- extends NonLeaf
- implements Statement, Ptree
The IfStatement
class represents a if statement node
of parse tree
- See Also:
- Ptree, NonLeaf, Statement, Expression, StatementList
-
IfStatement(Expression, StatementList)
- Constructs new IfStatement from prototype object
-
IfStatement(Expression, StatementList, StatementList)
- Constructs new IfStatement from prototype object
-
getElseStatements()
- Gets the else part of this if statement.
-
getExpression()
- Gets the condition of this if statement.
-
getStatements()
- Gets the then part of this if statement.
-
setElseStatements(StatementList)
- Sets the else part of this if statement.
-
setExpression(Expression)
- Sets the condition of this if statement.
-
setStatements(StatementList)
- Sets the then part of this if statement.
-
writeCode()
- Writes the code this parse-tree presents for.
IfStatement
public IfStatement(Expression expr,
StatementList stmts,
StatementList elsestmts)
- Constructs new IfStatement from prototype object
- Parameters:
- expr - the condition of this if statement.
- stmts - the statement that is executed when expr is ture
- elsestmts - the statement that is executed when expr is false.
If there is no else part then statement list is
empty.
IfStatement
public IfStatement(Expression expr,
StatementList stmts)
- Constructs new IfStatement from prototype object
- Parameters:
- expr - the condition of this if statement.
- stmts - the statement that is executed when expr is ture
writeCode
public void writeCode()
- Writes the code this parse-tree presents for.
- Overrides:
- writeCode in class NonLeaf
getExpression
public Expression getExpression()
- Gets the condition of this if statement.
- Returns:
- the expression of the condition.
setExpression
public void setExpression(Expression expr)
- Sets the condition of this if statement.
- Parameters:
- expr - the expression of the condition.
getStatements
public StatementList getStatements()
- Gets the then part of this if statement.
- Returns:
- the statement list of the then part.
setStatements
public void setStatements(StatementList thenstmts)
- Sets the then part of this if statement.
- Parameters:
- thenstmts - the statement list of the then part.
getElseStatements
public StatementList getElseStatements()
- Gets the else part of this if statement.
- Returns:
- the statement list of the else part.
setElseStatements
public void setElseStatements(StatementList elsestmts)
- Sets the else part of this if statement.
- Parameters:
- elsestmts - the statement list of the else part.
All Packages Class Hierarchy This Package Previous Next Index