|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Common interface for all sets that are not defined by a list of their elements but by a predicate that defines for each object if it is contained or not.
| Method Summary | |
GeneralPredicate |
and(GeneralPredicate p)
Returns the conjunction of this predicate and the specified predicate. |
GeneralPredicate |
andNot(GeneralPredicate p)
Returns the difference of this predicate and the specified predicate. |
GeneralPredicate |
copy()
Creates and returns a copy of this object. |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this Predicate. |
boolean |
evaluate(Object input)
Applies the predicate to an argument. |
boolean |
implies(GeneralPredicate p)
Tests if this predicate implies the specified predicate. |
boolean |
isEmpty()
Checks if the evaluate method of this predicate returns
always false. |
GeneralPredicate |
not()
Returns the negation of this predicate (optional operation). |
GeneralPredicate |
or(GeneralPredicate p)
Returns the disjunction of this predicate and the specified predicate. |
GeneralPredicate |
xor(GeneralPredicate p)
Returns the exclusive disjunction of this predicate and the specified predicate. |
| Method Detail |
public boolean equals(Object obj)
Predicate.
If two predicates are equal
it is expected that they return equal results for
all method calls with equal arguments,
in particular for the evaluate method.
equals in class Objectobj - the reference object with which to comparepublic GeneralPredicate copy()
public boolean isEmpty()
evaluate method of this predicate returns
always false.true if this predicate never holds.IllegalStateException - if it is not decidable if this
predicate is empty.public boolean evaluate(Object input)
evaluate in interface Predicateinput - argument on which the predicate is applied.public boolean implies(GeneralPredicate p)
evaluate method of the specified
predicate returns true for every argument for
which the evaluate method of this predicate
returns true,
or more formally:
implies(p) ⇔ ( ∀x evaluate(x) ⇒ p.evaluate(x) )It is not required but recommended that the inversion also holds.
p - predicate to be checked for implication in this predicate.ClassCastException - if this method is not implemented for
the specified predicate.IllegalArgumentException - if this method is not implemented for
the specified predicate.NullPointerException - if p is null.public GeneralPredicate not()
evaluate method of the negation returns
true, iff the evaluate methods of
this predicate returns false.
This interface does not specify the state of this object after the operation has been performed. It can be changed or unchanged. Therefore this method should either be used with a subinterface that specifies the state of this object or all references to it should be discarded afterwards.
UnsupportedOperationException - operation not implementedpublic GeneralPredicate and(GeneralPredicate p)
evaluate method of the conjunction returns
true, iff the evaluate methods of both
(this and the specified predicate) return true.
This interface does not specify the state of this object after the operation has been performed. It can be changed or unchanged. Therefore this method should either be used with a subinterface that specifies the state of this object or all references to it should be discarded afterwards.
p - predicate to be conjoined with this predicateClassCastException - if the conjunction of this predicate
and the specified predicate is not defined.IllegalArgumentException - if the conjunction of this predicate
and the specified predicate is not defined.NullPointerException - if p is null.public GeneralPredicate andNot(GeneralPredicate p)
evaluate method of the difference returns
true, iff the evaluate methods of this
predicate returns true and
the evaluate method of the specified predicate returns
false.
This interface does not specify the state of this object after the operation has been performed. It can be changed or unchanged. Therefore this method should either be used with a subinterface that specifies the state of this object or all references to it should be discarded afterwards.
p - predicate to be conjoined with this predicateClassCastException - if the difference of this predicate
and the specified predicate is not defined.IllegalArgumentException - if the difference of this predicate
and the specified predicate is not defined.NullPointerException - if p is null.public GeneralPredicate or(GeneralPredicate p)
evaluate method of the disjunction returns
false, iff the evaluate methods of both
(this and the specified predicate) return false.
This interface does not specify the state of this object after the operation has been performed. It can be changed or unchanged. Therefore this method should either be used with a subinterface that specifies the state of this object or all references to it should be discarded afterwards.
p - predicate to be conjoined with this predicateClassCastException - if the disjunction of this predicate
and the specified predicate is not defined.IllegalArgumentException - if the disjunction of this predicate
and the specified predicate is not defined.NullPointerException - if p is null.public GeneralPredicate xor(GeneralPredicate p)
evaluate method of the exclusive disjunction returns
true, iff the evaluate methods of one of
the predicates returns true and the
evaluate method of the other predicate returns
false.
This interface does not specify the state of this object after the operation has been performed. It can be changed or unchanged. Therefore this method should either be used with a subinterface that specifies the state of this object or all references to it should be discarded afterwards.
p - predicate to be conjoined with this predicateClassCastException - if the exclusive disjunction of this
predicate and the specified predicate is not defined.IllegalArgumentException - if the exclusive disjunction of this
predicate and the specified predicate is not defined.NullPointerException - if p is null.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||