org.jutil.predicate
Class Not

java.lang.Object
  |
  +--org.jutil.predicate.AbstractPredicate
        |
        +--org.jutil.predicate.Not
All Implemented Interfaces:
CollectionOperator, Predicate

public class Not
extends AbstractPredicate

A class of predicates that negate another predicate.


Field Summary
static java.lang.String CVS_REVISION
           
 
Constructor Summary
Not(Predicate predicate)
          Initialize a new Not with the given predicate.
 
Method Summary
 boolean eval(java.lang.Object object)
          Evaluate this Predicate for the given object.
 Predicate getPredicate()
          Return the negated predicate.
 java.util.List getSubPredicates()
          See superclass
 int nbSubPredicates()
          See superclass
 
Methods inherited from class org.jutil.predicate.AbstractPredicate
count, equals, exists, filter, forall
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jutil.java.collections.CollectionOperator
isValidElement
 

Field Detail

CVS_REVISION

public static final java.lang.String CVS_REVISION
Constructor Detail

Not

public Not(Predicate predicate)
Initialize a new Not with the given predicate.

Parameters:
predicate - The predicate to be negated.

Specifications:
public behavior
requires predicate != null;
ensures getPredicate() == predicate;
Method Detail

eval

public boolean eval(java.lang.Object object)
             throws java.lang.Exception
Description copied from interface: Predicate
Evaluate this Predicate for the given object.

Specifications:
     also
public behavior
ensures \result == !getPredicate().eval(object);

Specifications inherited from overridden method in interface Predicate:
public behavior
ensures \result == true|\result == false;
signals (Exception) !isValidElement(object);

getPredicate

public Predicate getPredicate()
Return the negated predicate.

Specifications:
public behavior
ensures \result == getSubPredicates().get(1);

getSubPredicates

public java.util.List getSubPredicates()
See superclass
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:
     also
public behavior
ensures \result == 1;

Specifications inherited from overridden method in class AbstractPredicate:
      --- None ---
Specifications inherited from overridden method in interface Predicate:
public behavior
ensures \result == getSubPredicates().size();