stsci.criteria
Class Compare

java.lang.Object
  |
  +--stsci.criteria.CriteriaImp
        |
        +--stsci.criteria.Compare
All Implemented Interfaces:
Criteria
Direct Known Subclasses:
Equal, Greater, Less

public abstract class Compare
extends CriteriaImp

Represents comparison operators on an attribute - attribute here means a public method of the given name. This constrcucts the method in the constructor and keeps it in the attr attribute. Getting a handle on the method is easy using introspection. To apply the Criteria to an object the method must be invoked to get the value for a particular object - this is done by getObjVal. So the concrete subclasses need only use getObjVal and compareTo to do a comparison.


Field Summary
protected  java.lang.reflect.Method attr
           
protected  java.lang.Comparable val
          Using comparable here means this is fiarly general - most object implement comparable so this will work for practically all attributes.
 
Fields inherited from class stsci.criteria.CriteriaImp
off, on
 
Constructor Summary
Compare(java.lang.Comparable v, java.lang.String a, java.lang.String c)
          operate on given attribute of given class comparing to the given object.
Compare(double v, java.lang.String a, java.lang.String c)
          operate on given double attribute of given class - Thisi s just for convenience.
 
Method Summary
protected  java.lang.Comparable getObjVal(java.lang.Object obj)
          This invokes the method to get the value for a given object.
 void setVal(java.lang.Comparable v)
          Sets the value to the given value
 void setVal(double v)
          Sets the value to the given double value - this is for convenience.
 
Methods inherited from class stsci.criteria.CriteriaImp
apply, match, setOff, setOn
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

val

protected java.lang.Comparable val
Using comparable here means this is fiarly general - most object implement comparable so this will work for practically all attributes.

attr

protected java.lang.reflect.Method attr
Constructor Detail

Compare

public Compare(java.lang.Comparable v,
               java.lang.String a,
               java.lang.String c)
operate on given attribute of given class comparing to the given object.

Compare

public Compare(double v,
               java.lang.String a,
               java.lang.String c)
operate on given double attribute of given class - Thisi s just for convenience.
Method Detail

getObjVal

protected java.lang.Comparable getObjVal(java.lang.Object obj)
This invokes the method to get the value for a given object.

setVal

public void setVal(java.lang.Comparable v)
Sets the value to the given value

setVal

public void setVal(double v)
Sets the value to the given double value - this is for convenience.