public class IfStatement extends Statement
| Constructor and Description |
|---|
IfStatement(Expression condition,
Statement true_clause)
Create an if statement that has no else clause.
|
IfStatement(Expression condition,
Statement true_clause,
Statement false_clause)
Create an if statement that has an else clause.
|
| Modifier and Type | Method and Description |
|---|---|
IfStatement |
clone()
Returns a clone of the if statement.
|
static void |
defaultPrint(IfStatement s,
java.io.PrintWriter o)
Prints an if statement to a stream.
|
Expression |
getControlExpression()
Returns the expression used as a branch condition.
|
Statement |
getElseStatement()
Returns the false clause of the if statement.
|
Statement |
getThenStatement()
Returns the then clause of the if statement.
|
static void |
setClassPrintMethod(java.lang.reflect.Method m)
Overrides the class print method, so that all subsequently
created objects will use the supplied method.
|
void |
setControlExpression(Expression cond)
Sets the condition expression with the specified new condition.
|
void |
setElseStatement(Statement stmt)
Sets the else clause with the specified new statement.
|
void |
setThenStatement(Statement stmt)
Sets the then clause with the specified new statement.
|
annotate, annotateAfter, annotateBefore, containsAnnotation, detach, equals, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getChildren, getParent, getProcedure, hashCode, print, removeAnnotations, removeAnnotations, removeChild, setChild, setLineNumber, setParent, setPrintMethod, swapWith, toString, verify, wherepublic IfStatement(Expression condition, Statement true_clause)
condition - The condition tested by the statement.true_clause - The code to execute if the condition is true.java.lang.IllegalArgumentException - if condition or true_clause
is null.NotAnOrphanException - if condition or true_clause has
a parent.public IfStatement(Expression condition, Statement true_clause, Statement false_clause)
condition - The condition tested by the statement.true_clause - The code to execute if the condition is true.false_clause - The code to execute if the condition is false.java.lang.IllegalArgumentException - if condition, true_clause,
or false_clause is null.NotAnOrphanException - if condition, true_clause, or
false_clause has a parent.public static void defaultPrint(IfStatement s, java.io.PrintWriter o)
s - The statement to print.o - The wirter on which to print the statement.public Expression getControlExpression()
public void setControlExpression(Expression cond)
cond - the new condition expression.java.lang.IllegalArgumentException - if cond is null.NotAnOrphanException - if cond has a parent.public Statement getThenStatement()
public void setThenStatement(Statement stmt)
stmt - the new statement for the then clause.java.lang.IllegalArgumentException - if stmt is null.NotAnOrphanException - if stmt has a parent.public Statement getElseStatement()
public void setElseStatement(Statement stmt)
stmt - the new statement for the else clause.java.lang.IllegalArgumentException - if stmt is null.NotAnOrphanException - if stmt has a parent.public static void setClassPrintMethod(java.lang.reflect.Method m)
m - The new print method.public IfStatement clone()