prefuse.data.expression
Class AbstractExpression

java.lang.Object
  extended by prefuse.data.expression.AbstractExpression
All Implemented Interfaces:
java.util.EventListener, ExpressionListener, Expression
Direct Known Subclasses:
AbstractPredicate, BinaryExpression, ColumnExpression, FunctionExpression, GroupExpression, IfExpression, Literal

public abstract class AbstractExpression
extends java.lang.Object
implements Expression, ExpressionListener

Abstract base class for Expression implementations. Provides support for listeners and defaults every Expression evaluation method to an unsupported operation.

Author:
jeffrey heer

Constructor Summary
AbstractExpression()
           
 
Method Summary
protected  void addChildListeners()
          Add child listeners to catch and propagate sub-expression updates.
 void addExpressionListener(ExpressionListener lstnr)
          Add a listener to this Expression.
 void expressionChanged(Expression expr)
          Relay an expression change event.
protected  void fireExpressionChange()
          Fire an expression change.
 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.
 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.
protected  boolean hasListeners()
          Indicates if any listeners are registered with this Expression.
protected  void removeChildListeners()
          Remove child listeners for sub-expression updates.
 void removeExpressionListener(ExpressionListener lstnr)
          Remove a listener to this Expression.
 void visit(ExpressionVisitor v)
          Passes the visitor through this expression and any sub expressions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface prefuse.data.expression.Expression
getType
 

Constructor Detail

AbstractExpression

public AbstractExpression()
Method Detail

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
Parameters:
v - the ExpressionVisitor
See Also:
Expression.visit(prefuse.data.expression.ExpressionVisitor)

addExpressionListener

public final void addExpressionListener(ExpressionListener lstnr)
Description copied from interface: Expression
Add a listener to this Expression.

Specified by:
addExpressionListener in interface Expression
Parameters:
lstnr - the expression listener to add
See Also:
Expression.addExpressionListener(prefuse.data.event.ExpressionListener)

removeExpressionListener

public final void removeExpressionListener(ExpressionListener lstnr)
Description copied from interface: Expression
Remove a listener to this Expression.

Specified by:
removeExpressionListener in interface Expression
Parameters:
lstnr - the expression listener to remove
See Also:
Expression.removeExpressionListener(prefuse.data.event.ExpressionListener)

hasListeners

protected final boolean hasListeners()
Indicates if any listeners are registered with this Expression.

Returns:
true if listeners are registered, false otherwise

fireExpressionChange

protected final void fireExpressionChange()
Fire an expression change.


addChildListeners

protected void addChildListeners()
Add child listeners to catch and propagate sub-expression updates.


removeChildListeners

protected void removeChildListeners()
Remove child listeners for sub-expression updates.


expressionChanged

public void expressionChanged(Expression expr)
Relay an expression change event.

Specified by:
expressionChanged in interface ExpressionListener
Parameters:
expr - the modified expression
See Also:
ExpressionListener.expressionChanged(prefuse.data.expression.Expression)

get

public java.lang.Object get(Tuple t)
By default, throws an UnsupportedOperationException.

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

getInt

public int getInt(Tuple t)
By default, throws an UnsupportedOperationException.

Specified by:
getInt in interface Expression
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)
By default, throws an UnsupportedOperationException.

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

getFloat

public float getFloat(Tuple t)
By default, throws an UnsupportedOperationException.

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

getDouble

public double getDouble(Tuple t)
By default, throws an UnsupportedOperationException.

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

getBoolean

public boolean getBoolean(Tuple t)
By default, throws an UnsupportedOperationException.

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


Copyright © 2007 Regents of the University of California