prefuse.data.expression
Class ComparisonPredicate

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

public class ComparisonPredicate
extends BinaryExpression
implements Predicate

Predicate implementation that computes a comparison operation. Supported operations are equals, not equals, less than, greater than, less than or equal to, and greater than or equal to.

Author:
jeffrey heer

Field Summary
static int EQ
          Indicates a equals comparison.
static int GT
          Indicates a greater-than comparison.
static int GTEQ
          Indicates a greater-than-or-equals comparison.
static int LT
          Indicates a less-than comparison.
static int LTEQ
          Indicates a less-than-or-equals comparison.
static int NEQ
          Indicates a not-equals comparison.
 
Fields inherited from class prefuse.data.expression.BinaryExpression
m_left, m_op, m_right
 
Constructor Summary
ComparisonPredicate(int operation, Expression left, Expression right)
          Create a new ComparisonPredicate.
ComparisonPredicate(int operation, Expression left, Expression right, java.util.Comparator cmp)
          Create a new ComparisonPredicate.
 
Method Summary
 java.lang.Object get(Tuple t)
          By default, throws an UnsupportedOperationException.
 boolean getBoolean(Tuple t)
          By default, throws an UnsupportedOperationException.
 java.util.Comparator getComparator()
          Get the comparator used to compare instances.
 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, getDouble, getFloat, getInt, getLong, hasListeners, removeExpressionListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface prefuse.data.expression.Expression
addExpressionListener, getDouble, getFloat, getInt, getLong, removeExpressionListener, visit
 

Field Detail

LT

public static final int LT
Indicates a less-than comparison.

See Also:
Constant Field Values

GT

public static final int GT
Indicates a greater-than comparison.

See Also:
Constant Field Values

EQ

public static final int EQ
Indicates a equals comparison.

See Also:
Constant Field Values

NEQ

public static final int NEQ
Indicates a not-equals comparison.

See Also:
Constant Field Values

LTEQ

public static final int LTEQ
Indicates a less-than-or-equals comparison.

See Also:
Constant Field Values

GTEQ

public static final int GTEQ
Indicates a greater-than-or-equals comparison.

See Also:
Constant Field Values
Constructor Detail

ComparisonPredicate

public ComparisonPredicate(int operation,
                           Expression left,
                           Expression right)
Create a new ComparisonPredicate. Uses a default comparator instance.

Parameters:
operation - the comparison operation to compute
left - the left sub-expression
right - the right sub-expression

ComparisonPredicate

public ComparisonPredicate(int operation,
                           Expression left,
                           Expression right,
                           java.util.Comparator cmp)
Create a new ComparisonPredicate.

Parameters:
operation - the comparison operation to compute
left - the left sub-expression
right - the right sub-expression
cmp - the comparator to use to compare values
Method Detail

getComparator

public java.util.Comparator getComparator()
Get the comparator used to compare instances.

Returns:
the comparator instance

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.

Specified by:
getType in interface Expression
See Also:
Expression.getType(prefuse.data.Schema)

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)

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)

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