gate.jape.constraint
Class ComparablePredicate

java.lang.Object
  extended by gate.jape.constraint.AbstractConstraintPredicate
      extended by gate.jape.constraint.ComparablePredicate
All Implemented Interfaces:
ConstraintPredicate, Serializable
Direct Known Subclasses:
ComparablePredicateTest.ComparablePredicateImpl, GreaterEqualPredicate, GreaterPredicate, LesserEqualPredicate, LesserPredicate

public abstract class ComparablePredicate
extends AbstractConstraintPredicate

Base class for those predicates which use compareTo to compare values.

Version:
$Revision$
Author:
esword
See Also:
Serialized Form

Field Summary
protected  Comparable comparableValue
           
 
Fields inherited from class gate.jape.constraint.AbstractConstraintPredicate
accessor, value
 
Fields inherited from interface gate.jape.constraint.ConstraintPredicate
EQUAL, GREATER, GREATER_OR_EQUAL, LESSER, LESSER_OR_EQUAL, NOT_EQUAL, NOT_REGEXP_FIND, NOT_REGEXP_MATCH, REGEXP_FIND, REGEXP_MATCH
 
Constructor Summary
ComparablePredicate()
           
 
Method Summary
protected  int compareValue(Object obj)
          Use compareTo to compare set value with the given object, doing basic type conversion to get the two objects to the same class.
protected abstract  boolean doMatch(Object featureValue)
           
 boolean doMatch(Object value, AnnotationSet context)
           
 void setValue(Object value)
          Value must be a Comparable
 
Methods inherited from class gate.jape.constraint.AbstractConstraintPredicate
equals, getAccessor, getValue, hashCode, matches, setAccessor, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gate.jape.constraint.ConstraintPredicate
getOperator
 

Field Detail

comparableValue

protected Comparable comparableValue
Constructor Detail

ComparablePredicate

public ComparablePredicate()
Method Detail

setValue

public void setValue(Object value)
Value must be a Comparable

Specified by:
setValue in interface ConstraintPredicate
Overrides:
setValue in class AbstractConstraintPredicate

doMatch

public boolean doMatch(Object value,
                       AnnotationSet context)
                throws JapeException
Specified by:
doMatch in class AbstractConstraintPredicate
Throws:
JapeException

doMatch

protected abstract boolean doMatch(Object featureValue)
                            throws JapeException
Throws:
JapeException

compareValue

protected int compareValue(Object obj)
                    throws JapeException
Use compareTo to compare set value with the given object, doing basic type conversion to get the two objects to the same class.

Throws:
JapeException - if the provided object is not a Comparable or the classes cannot be compared.