org.jutil.predicate
Class Or
java.lang.Object
|
+--org.jutil.predicate.AbstractPredicate
|
+--org.jutil.predicate.CompositePredicate
|
+--org.jutil.predicate.Or
- All Implemented Interfaces:
- CollectionOperator, Predicate
- public class Or
- extends CompositePredicate
A class of predicates that evaluates to the or of a number
of other predicates.
For efficiency reasons, the conditional or will be
computed.
|
Constructor Summary |
Or()
Initialize a new empty Or. |
Or(Predicate first,
Predicate second)
Initialize a new Or with the given predicates. |
Or(Predicate[] predicates)
Initialize a new Or with the given predicates. |
|
Method Summary |
boolean |
eval(java.lang.Object object)
Evaluate this Predicate for the given object. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CVS_REVISION
public static final java.lang.String CVS_REVISION
Or
public Or()
- Initialize a new empty Or.
- Specifications:
-
public behavior
ensures nbSubPredicates() == 0;
Or
public Or(Predicate first,
Predicate second)
- Initialize a new Or with the given predicates.
- Parameters:
first - The first predicate.second - The second predicate.
- Specifications:
-
public behavior
requires first != null;
requires second != null;
ensures predicateAt(1) == first;
ensures predicateAt(2) == second;
Or
public Or(Predicate[] predicates)
- Initialize a new Or with the given predicates.
- Parameters:
predicates - An array containing the predicates.
- Specifications:
-
public behavior
requires predicates != null;
requires ( \forall int i; i >= 0&&i < predicates.length; predicates[i] != null);
ensures ( \forall int i; i >= 0&&i < predicates.length; getSubPredicates().get(i) == predicates[i]);
ensures nbSubPredicates() == predicates.length;
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 == ( \exists Predicate p; getSubPredicates().contains(p); p.eval(object));
- Specifications inherited from overridden method in interface Predicate:
-
public behavior
ensures \result == true|\result == false;
signals (Exception) !isValidElement(object);