org.oreodata.predicates
Class SimplePredicate

java.lang.Object
  |
  +--org.oreodata.predicates.Predicate
        |
        +--org.oreodata.predicates.SimplePredicate
All Implemented Interfaces:
RecordFilter, java.io.Serializable

public class SimplePredicate
extends Predicate

A Predicate that represents a simple comparison filter.

Author:
Jonathan Revusky
See Also:
Serialized Form

Field Summary
static int EQUALS
           
static int GREATER_THAN
           
static int GREATER_THAN_EQUALS
           
static int IS_NULL
           
static int LESS_THAN
           
static int LESS_THAN_EQUALS
           
static int LIKE
           
static int NOT_EQUALS
           
static int NOT_LIKE
           
static int NOT_NULL
           
 
Fields inherited from class org.oreodata.predicates.Predicate
complement
 
Constructor Summary
protected SimplePredicate(int comparisonType, java.lang.String recType, java.lang.String fieldName, java.lang.Object comparisonValue, java.util.Comparator comparator)
           
protected SimplePredicate(int comparisonType, java.lang.String recType, java.lang.String fieldName, java.lang.Object comparisonValue, java.util.Comparator comparator, boolean caseInsensitive)
           
 
Method Summary
 boolean accept(Record rec)
          Does this record meet the filter criterion?
 Predicate getComplement()
           
 java.lang.String recType()
          says what kind of record type we are looking for, i.e.
 java.lang.String sqlEquivalent()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IS_NULL

public static final int IS_NULL
See Also:
Constant Field Values

EQUALS

public static final int EQUALS
See Also:
Constant Field Values

GREATER_THAN

public static final int GREATER_THAN
See Also:
Constant Field Values

LESS_THAN

public static final int LESS_THAN
See Also:
Constant Field Values

LIKE

public static final int LIKE
See Also:
Constant Field Values

NOT_NULL

public static final int NOT_NULL
See Also:
Constant Field Values

NOT_EQUALS

public static final int NOT_EQUALS
See Also:
Constant Field Values

LESS_THAN_EQUALS

public static final int LESS_THAN_EQUALS
See Also:
Constant Field Values

GREATER_THAN_EQUALS

public static final int GREATER_THAN_EQUALS
See Also:
Constant Field Values

NOT_LIKE

public static final int NOT_LIKE
See Also:
Constant Field Values
Constructor Detail

SimplePredicate

protected SimplePredicate(int comparisonType,
                          java.lang.String recType,
                          java.lang.String fieldName,
                          java.lang.Object comparisonValue,
                          java.util.Comparator comparator,
                          boolean caseInsensitive)

SimplePredicate

protected SimplePredicate(int comparisonType,
                          java.lang.String recType,
                          java.lang.String fieldName,
                          java.lang.Object comparisonValue,
                          java.util.Comparator comparator)
Method Detail

sqlEquivalent

public java.lang.String sqlEquivalent()
Specified by:
sqlEquivalent in interface RecordFilter
Specified by:
sqlEquivalent in class Predicate
Returns:
The SQL SELECT command that is the equivalent to this. A null value would indicate that we don't know the SQL command. In that case, the filter will have to be applied in-memory.

accept

public boolean accept(Record rec)
Description copied from interface: RecordFilter
Does this record meet the filter criterion?

Specified by:
accept in interface RecordFilter
Specified by:
accept in class Predicate

getComplement

public Predicate getComplement()
Specified by:
getComplement in class Predicate

recType

public java.lang.String recType()
Description copied from interface: RecordFilter
says what kind of record type we are looking for, i.e. the filter will only return results of a certain record type. If this returns null, it means that we could have heterogeneous results.

Specified by:
recType in interface RecordFilter
Specified by:
recType in class Predicate