prefuse.data.expression
Class IfExpression

java.lang.Object
  extended by prefuse.data.expression.AbstractExpression
      extended by prefuse.data.expression.IfExpression
All Implemented Interfaces:
java.util.EventListener, ExpressionListener, Expression

public class IfExpression
extends AbstractExpression

Expression instance representing an "if then else" clause in the prefuse expression language.

Author:
jeffrey heer

Constructor Summary
IfExpression(Predicate test, Expression thenExpr, Expression elseExpr)
          Create a new IfExpression.
 
Method Summary
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
 
Methods inherited from class prefuse.data.expression.AbstractExpression
addExpressionListener, expressionChanged, fireExpressionChange, hasListeners, removeExpressionListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IfExpression

public IfExpression(Predicate test,
                    Expression thenExpr,
                    Expression elseExpr)
Create a new IfExpression.

Parameters:
test - the predicate test for the if statement
thenExpr - the expression to evaluate if the test predicate evaluates to true
elseExpr - the expression to evaluate if the test predicate evaluates to false
Method Detail

getTestPredicate

public Predicate getTestPredicate()
Get the test predicate.

Returns:
the test predicate

getThenExpression

public Expression getThenExpression()
Get the then expression

Returns:
the then expression

getElseExpression

public Expression getElseExpression()
Get the else expression

Returns:
the else expression

setTestPredicate

public void setTestPredicate(Predicate p)
Set the test predicate.

Parameters:
p - the test predicate

setThenExpression

public void setThenExpression(Expression e)
Set the then expression

Parameters:
e - the then expression to set

setElseExpression

public void setElseExpression(Expression e)
Set the else expression

Parameters:
e - the else expression to set

getType

public java.lang.Class getType(Schema s)
Description copied from interface: Expression
Returns the type that this expression evaluates to when tuples with the given Schema are provided as input.

See Also:
Expression.getType(prefuse.data.Schema)

get

public java.lang.Object get(Tuple t)
Description copied from class: AbstractExpression
By default, throws an UnsupportedOperationException.

Specified by:
get in interface Expression
Overrides:
get in class AbstractExpression
Parameters:
t - the input Tuple
Returns:
the Expression return value, as an Object
See Also:
Expression.get(prefuse.data.Tuple)

getBoolean

public boolean getBoolean(Tuple t)
Description copied from class: AbstractExpression
By default, throws an UnsupportedOperationException.

Specified by:
getBoolean in interface Expression
Overrides:
getBoolean in class AbstractExpression
Parameters:
t - the input Tuple
Returns:
the Expression return value, as a boolean
See Also:
Expression.getBoolean(prefuse.data.Tuple)

getDouble

public double getDouble(Tuple t)
Description copied from class: AbstractExpression
By default, throws an UnsupportedOperationException.

Specified by:
getDouble in interface Expression
Overrides:
getDouble in class AbstractExpression
Parameters:
t - the input Tuple
Returns:
the Expression return value, as a double
See Also:
Expression.getDouble(prefuse.data.Tuple)

getFloat

public float getFloat(Tuple t)
Description copied from class: AbstractExpression
By default, throws an UnsupportedOperationException.

Specified by:
getFloat in interface Expression
Overrides:
getFloat in class AbstractExpression
Parameters:
t - the input Tuple
Returns:
the Expression return value, as a float
See Also:
Expression.getFloat(prefuse.data.Tuple)

getInt

public int getInt(Tuple t)
Description copied from class: AbstractExpression
By default, throws an UnsupportedOperationException.

Specified by:
getInt in interface Expression
Overrides:
getInt in class AbstractExpression
Parameters:
t - the input Tuple
Returns:
the Expression return value, as an int
See Also:
Expression.getInt(prefuse.data.Tuple)

getLong

public long getLong(Tuple t)
Description copied from class: AbstractExpression
By default, throws an UnsupportedOperationException.

Specified by:
getLong in interface Expression
Overrides:
getLong in class AbstractExpression
Parameters:
t - the input Tuple
Returns:
the Expression return value, as a long
See Also:
Expression.getLong(prefuse.data.Tuple)

visit

public void visit(ExpressionVisitor v)
Description copied from interface: Expression
Passes the visitor through this expression and any sub expressions

Specified by:
visit in interface Expression
Overrides:
visit in class AbstractExpression
Parameters:
v - the ExpressionVisitor
See Also:
Expression.visit(prefuse.data.expression.ExpressionVisitor)

addChildListeners

protected void addChildListeners()
Description copied from class: AbstractExpression
Add child listeners to catch and propagate sub-expression updates.

Overrides:
addChildListeners in class AbstractExpression
See Also:
AbstractExpression.addChildListeners()

removeChildListeners

protected void removeChildListeners()
Description copied from class: AbstractExpression
Remove child listeners for sub-expression updates.

Overrides:
removeChildListeners in class AbstractExpression
See Also:
AbstractExpression.removeChildListeners()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2007 Regents of the University of California