prefuse.data.expression
Class ArithmeticExpression

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

public class ArithmeticExpression
extends BinaryExpression

Expression supporting basic arithmetic: add, subtract, multiply, divide, exponentiate (pow), and modulo (%).

Author:
jeffrey heer

Field Summary
static int ADD
          Indicates an addition operation.
static int DIV
          Indicates a division operation.
static int MOD
          Indicates a modulo operation.
static int MUL
          Indicates a multiplication operation.
static int POW
          Indicates an exponentiation (pow) operation.
static int SUB
          Indicates a subtraction operation.
 
Fields inherited from class prefuse.data.expression.BinaryExpression
m_left, m_op, m_right
 
Constructor Summary
ArithmeticExpression(int operation, Expression left, Expression right)
          Create a new ArithmeticExpression.
 
Method Summary
 java.lang.Object get(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.
 java.lang.Class getType(Schema s)
          Returns the type that this expression evaluates to when tuples with the given Schema are provided as input.
 java.lang.String toString()
           
 
Methods inherited from class prefuse.data.expression.BinaryExpression
addChildListeners, getLeftExpression, getOperation, getRightExpression, removeChildListeners, setLeftExpression, setRightExpression, visit
 
Methods inherited from class prefuse.data.expression.AbstractExpression
addExpressionListener, expressionChanged, fireExpressionChange, getBoolean, hasListeners, removeExpressionListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ADD

public static final int ADD
Indicates an addition operation.

See Also:
Constant Field Values

SUB

public static final int SUB
Indicates a subtraction operation.

See Also:
Constant Field Values

MUL

public static final int MUL
Indicates a multiplication operation.

See Also:
Constant Field Values

DIV

public static final int DIV
Indicates a division operation.

See Also:
Constant Field Values

POW

public static final int POW
Indicates an exponentiation (pow) operation.

See Also:
Constant Field Values

MOD

public static final int MOD
Indicates a modulo operation.

See Also:
Constant Field Values
Constructor Detail

ArithmeticExpression

public ArithmeticExpression(int operation,
                            Expression left,
                            Expression right)
Create a new ArithmeticExpression.

Parameters:
operation - the operation to perform
left - the left sub-expression
right - the right sub-expression
Method Detail

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)

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)

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)

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)

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