org.jutil.predicate
Class BinaryPredicate
java.lang.Object
|
+--org.jutil.predicate.AbstractPredicate
|
+--org.jutil.predicate.BinaryPredicate
- All Implemented Interfaces:
- CollectionOperator, Predicate
- Direct Known Subclasses:
- Implication, Xor
- public abstract class BinaryPredicate
- extends AbstractPredicate
A class of predicates that evaluates an object using two other predicates.
| 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
BinaryPredicate
public BinaryPredicate(Predicate first,
Predicate second)
- Initialize a new BinaryPredicate with the given predicates.
- Parameters:
first - The first predicate.second - The second predicate.
- Specifications:
-
public behavior
requires first != null;
requires second != null;
ensures getFirst() == first;
ensures getSecond() == second;
getFirst
public Predicate getFirst()
- Return the first total predicate of this BinaryPredicate.
- Specifications:
-
public behavior
ensures \result != null;
setFirst
public void setFirst(Predicate predicate)
- Set the first predicate of this BinaryPredicate.
- Parameters:
predicate - The new first predicate of this BinaryPredicate.
- Specifications:
-
public behavior
requires predicate != null;
requires predicate != this;
requires !predicate.getSubPredicates().contains(this);
ensures getFirst() == predicate;
getSecond
public Predicate getSecond()
- Return the second total predicate of this BinaryPredicate.
- Specifications:
-
public behavior
ensures \result != null;
setSecond
public void setSecond(Predicate predicate)
- Set the second predicate of this BinaryPredicate.
- Parameters:
predicate - The new second predicate of this BinaryPredicate.
- Specifications:
-
public behavior
requires predicate != null;
requires predicate != this;
requires !predicate.getSubPredicates().contains(this);
ensures getSecond() == predicate;
getSubPredicates
public java.util.List getSubPredicates()
- Description copied from interface:
Predicate
- Return the subpredicates of this Predicate.
- Specifications:
- also
-
public behavior
ensures Collections.containsExplicitly(\result ,getFirst());
ensures Collections.containsExplicitly(\result ,getSecond());
ensures \result .size() == 2;
- 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 == 2;
- Specifications inherited from overridden method in class AbstractPredicate:
--- None ---
- Specifications inherited from overridden method in interface Predicate:
-
public behavior
ensures \result == getSubPredicates().size();