simpledb
Class Predicate

java.lang.Object
  extended by simpledb.Predicate

public class Predicate
extends java.lang.Object

Predicate compares tuples to a specified Field value.


Nested Class Summary
static class Predicate.Op
          Constants used for return codes in Field.compare
 
Constructor Summary
Predicate(int field, Predicate.Op op, Field operand)
          Constructor.
 
Method Summary
 boolean filter(Tuple t)
          Compares the field number of t specified in the constructor to the operand field specified in the constructor using the operator specific in the constructor.
 java.lang.String toString()
          Returns something useful, like "f = field_id op = op_string operand = operand_string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Predicate

public Predicate(int field,
                 Predicate.Op op,
                 Field operand)
Constructor.

Parameters:
field - field number of passed in tuples to compare against.
op - operation to use for comparison
operand - field value to compare passed in tuples to
Method Detail

filter

public boolean filter(Tuple t)
Compares the field number of t specified in the constructor to the operand field specified in the constructor using the operator specific in the constructor. The comparison can be made through Field's compare method.

Parameters:
t - The tuple to compare against
Returns:
true if the comparison is true, false otherwise.

toString

public java.lang.String toString()
Returns something useful, like "f = field_id op = op_string operand = operand_string

Overrides:
toString in class java.lang.Object