org.jutil.predicate
Class PrimitiveTotalPredicate

java.lang.Object
  |
  +--org.jutil.predicate.AbstractPredicate
        |
        +--org.jutil.predicate.TotalPredicate
              |
              +--org.jutil.predicate.PrimitiveTotalPredicate
All Implemented Interfaces:
CollectionOperator, Predicate
Direct Known Subclasses:
Equal, False, Identical, NotNull, True, TypePredicate

public abstract class PrimitiveTotalPredicate
extends TotalPredicate

A class of total predicates that have no subpredicates.

This class implements the nbSubPredicates() and getSubPredicates() methods for predicates that don't contain any sub predicates.

Typically, this class will be used as an anonymous inner class as follows:


TotalPredicate myPredicate = new PrimitiveTotalPredicate() {
            public boolean eval(Object o) {
              //calculate boolean value
              //using the given object
            }
          };


Field Summary
static java.lang.String CVS_REVISION
           
 
Constructor Summary
PrimitiveTotalPredicate()
           
 
Method Summary
 java.util.List getSubPredicates()
          Return the subpredicates of this Predicate.
 int nbSubPredicates()
          See superclass
 
Methods inherited from class org.jutil.predicate.TotalPredicate
count, eval, exists, filter, forall, isValidElement
 
Methods inherited from class org.jutil.predicate.AbstractPredicate
equals
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CVS_REVISION

public static final java.lang.String CVS_REVISION
Constructor Detail

PrimitiveTotalPredicate

public PrimitiveTotalPredicate()
Method Detail

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();