org.jutil.predicate
Class PrimitivePredicate
java.lang.Object
|
+--org.jutil.predicate.AbstractPredicate
|
+--org.jutil.predicate.PrimitivePredicate
- All Implemented Interfaces:
- CollectionOperator, Predicate
- public abstract class PrimitivePredicate
- extends AbstractPredicate
A class of predicates that have no subpredicates.
Since a primitive predicate does not contain any subpredicates, this
abstract class implements
nbSubPredicates()
and getSubPredicates().
Typically, this class will be used as an anonymous inner class as follows:
Predicate myPredicate = new PrimitivePredicate() {
/oo
o also public behavior
o
o post postcondition;
o/
public boolean eval(Object o) throws MyException {
//calculate boolean value
//using the given object
}
};
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jutil.predicate.Predicate |
eval |
CVS_REVISION
public static final java.lang.String CVS_REVISION
PrimitivePredicate
public PrimitivePredicate()
getSubPredicates
public java.util.List getSubPredicates()
- Description copied from interface:
Predicate
- Return the subpredicates of this Predicate.
- Specifications:
- also
-
public behavior
ensures \result .size() == 0;
- Specifications inherited from overridden method in interface Predicate:
-
public behavior
ensures \result != null;
ensures !\result .contains(null);
ensures !\result .contains(this);
nbSubPredicates
public int nbSubPredicates()
- See superclass
- Specifications inherited from overridden method in class AbstractPredicate:
--- None ---
- Specifications inherited from overridden method in interface Predicate:
-
public behavior
ensures \result == getSubPredicates().size();