public class IfExpression extends AbstractExpression
Constructor and Description |
---|
IfExpression(Predicate test,
Expression thenExpr,
Expression elseExpr)
Create a new IfExpression.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addChildListeners()
Add child listeners to catch and propagate sub-expression updates.
|
java.lang.Object |
get(Tuple t)
By default, throws an UnsupportedOperationException.
|
boolean |
getBoolean(Tuple t)
By default, throws an UnsupportedOperationException.
|
double |
getDouble(Tuple t)
By default, throws an UnsupportedOperationException.
|
Expression |
getElseExpression()
Get the else expression
|
float |
getFloat(Tuple t)
By default, throws an UnsupportedOperationException.
|
int |
getInt(Tuple t)
By default, throws an UnsupportedOperationException.
|
long |
getLong(Tuple t)
By default, throws an UnsupportedOperationException.
|
Predicate |
getTestPredicate()
Get the test predicate.
|
Expression |
getThenExpression()
Get the then expression
|
java.lang.Class |
getType(Schema s)
Returns the type that this expression evaluates to when tuples
with the given Schema are provided as input.
|
protected void |
removeChildListeners()
Remove child listeners for sub-expression updates.
|
void |
setElseExpression(Expression e)
Set the else expression
|
void |
setTestPredicate(Predicate p)
Set the test predicate.
|
void |
setThenExpression(Expression e)
Set the then expression
|
java.lang.String |
toString() |
void |
visit(ExpressionVisitor v)
Passes the visitor through this expression and any sub expressions
|
addExpressionListener, expressionChanged, fireExpressionChange, hasListeners, removeExpressionListener
public IfExpression(Predicate test, Expression thenExpr, Expression elseExpr)
test
- the predicate test for the if statementthenExpr
- the expression to evaluate if the test predicate
evaluates to trueelseExpr
- the expression to evaluate if the test predicate
evaluates to falsepublic Predicate getTestPredicate()
public Expression getThenExpression()
public Expression getElseExpression()
public void setTestPredicate(Predicate p)
p
- the test predicatepublic void setThenExpression(Expression e)
e
- the then expression to setpublic void setElseExpression(Expression e)
e
- the else expression to setpublic java.lang.Class getType(Schema s)
Expression
public java.lang.Object get(Tuple t)
AbstractExpression
get
in interface Expression
get
in class AbstractExpression
t
- the input TupleExpression.get(prefuse.data.Tuple)
public boolean getBoolean(Tuple t)
AbstractExpression
getBoolean
in interface Expression
getBoolean
in class AbstractExpression
t
- the input TupleExpression.getBoolean(prefuse.data.Tuple)
public double getDouble(Tuple t)
AbstractExpression
getDouble
in interface Expression
getDouble
in class AbstractExpression
t
- the input TupleExpression.getDouble(prefuse.data.Tuple)
public float getFloat(Tuple t)
AbstractExpression
getFloat
in interface Expression
getFloat
in class AbstractExpression
t
- the input TupleExpression.getFloat(prefuse.data.Tuple)
public int getInt(Tuple t)
AbstractExpression
getInt
in interface Expression
getInt
in class AbstractExpression
t
- the input TupleExpression.getInt(prefuse.data.Tuple)
public long getLong(Tuple t)
AbstractExpression
getLong
in interface Expression
getLong
in class AbstractExpression
t
- the input TupleExpression.getLong(prefuse.data.Tuple)
public void visit(ExpressionVisitor v)
Expression
visit
in interface Expression
visit
in class AbstractExpression
v
- the ExpressionVisitorExpression.visit(prefuse.data.expression.ExpressionVisitor)
protected void addChildListeners()
AbstractExpression
addChildListeners
in class AbstractExpression
AbstractExpression.addChildListeners()
protected void removeChildListeners()
AbstractExpression
removeChildListeners
in class AbstractExpression
AbstractExpression.removeChildListeners()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
Copyright ? 2013 Regents of the University of California