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

Constructor Index

 o IfStatement(Expression, StatementList)
Constructs new IfStatement from prototype object
 o IfStatement(Expression, StatementList, StatementList)
Constructs new IfStatement from prototype object

Method Index

 o getElseStatements()
Gets the else part of this if statement.
 o getExpression()
Gets the condition of this if statement.
 o getStatements()
Gets the then part of this if statement.
 o setElseStatements(StatementList)
Sets the else part of this if statement.
 o setExpression(Expression)
Sets the condition of this if statement.
 o setStatements(StatementList)
Sets the then part of this if statement.
 o writeCode()
Writes the code this parse-tree presents for.

Constructors

 o 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.
 o 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

Methods

 o writeCode
 public void writeCode()
Writes the code this parse-tree presents for.

Overrides:
writeCode in class NonLeaf
 o getExpression
 public Expression getExpression()
Gets the condition of this if statement.

Returns:
the expression of the condition.
 o setExpression
 public void setExpression(Expression expr)
Sets the condition of this if statement.

Parameters:
expr - the expression of the condition.
 o getStatements
 public StatementList getStatements()
Gets the then part of this if statement.

Returns:
the statement list of the then part.
 o setStatements
 public void setStatements(StatementList thenstmts)
Sets the then part of this if statement.

Parameters:
thenstmts - the statement list of the then part.
 o getElseStatements
 public StatementList getElseStatements()
Gets the else part of this if statement.

Returns:
the statement list of the else part.
 o 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