public class ConditionalExpression extends Expression
Constructor and Description |
---|
ConditionalExpression(Expression condition,
Expression true_expr,
Expression false_expr)
Constructs a conditional expression with the specified condition, true
part, and false part.
|
Modifier and Type | Method and Description |
---|---|
ConditionalExpression |
clone()
Creates and returns a deep copy of this expression.
|
static void |
defaultPrint(ConditionalExpression e,
java.io.PrintWriter o)
Prints a conditional expression to a stream.
|
Expression |
getCondition()
Returns the condition expression.
|
Expression |
getFalseExpression()
Returns the expression that follows the false jump.
|
Expression |
getTrueExpression()
Returns the expression that follows the true jump.
|
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 |
setCondition(Expression expr)
Sets the condition expression with the specifed new expression.
|
void |
setFalseExpression(Expression expr)
Sets the false expression with the specifed new expression.
|
void |
setTrueExpression(Expression expr)
Sets the true expression with the specifed new expression.
|
java.lang.String |
toString()
Returns a string representation of the expression
|
compareTo, equals, findExpression, getChildren, getParent, getStatement, hashCode, needsParens, print, printSelf, removeChild, setChild, setParens, setParent, setPrintMethod, swapWith, verify
public ConditionalExpression(Expression condition, Expression true_expr, Expression false_expr)
condition
- the condition expression.true_expr
- the expression being evaluated if condition is
true.false_expr
- the expression being evaluated if condition is
false.java.lang.IllegalArgumentException
- if one of the parameters is invalid.NotAnOrphanException
- if one of the parameters has a parent object.public static void defaultPrint(ConditionalExpression e, java.io.PrintWriter o)
e
- The expression to print.o
- The writer on which to print the expression.public java.lang.String toString()
Expression
toString
in class Expression
public Expression getCondition()
public Expression getFalseExpression()
public Expression getTrueExpression()
public static void setClassPrintMethod(java.lang.reflect.Method m)
m
- The new print method.public void setCondition(Expression expr)
expr
- the new condition expression.java.lang.IllegalArgumentException
- if expr is invalid.NotAnOrphanException
- if expr has a parent object.public void setFalseExpression(Expression expr)
expr
- the new false expression.java.lang.IllegalArgumentException
- if expr is invalid.NotAnOrphanException
- if expr has a parent object.public void setTrueExpression(Expression expr)
expr
- the new true expression.java.lang.IllegalArgumentException
- if expr is invalid.NotAnOrphanException
- if expr has a parent object.public ConditionalExpression clone()
Expression
clone
in class Expression