net.sf.molae.logic.basic
Class CopyingPredicate
java.lang.Object
|
+--net.sf.molae.pipe.basic.ObjectProxy
|
+--net.sf.molae.logic.basic.GeneralPredicateProxy
|
+--net.sf.molae.logic.basic.CopyingPredicate
- All Implemented Interfaces:
- GeneralPredicate, Predicate, ProxyProvider, SinglePredicate
- public final class CopyingPredicate
- extends GeneralPredicateProxy
- implements SinglePredicate
Allows a GeneralPredicate to behave like a single predicate.
All modifying methods use copies of the base predicate,
so the underlying GeneralPredicate is never changed.
- Since:
- 1.1
| Methods inherited from class net.sf.molae.logic.basic.GeneralPredicateProxy |
and, andNot, className, evaluate, getBasePredicate, getProxyFor, implies, isEmpty, or, toString, xor |
getInstance
public static SinglePredicate getInstance(GeneralPredicate p)
- Constructs a CopyingPredicate object.
- Parameters:
p - the underlying GeneralPredicate- Returns:
- a SinglePredicate
copy
public GeneralPredicate copy()
- Description copied from interface:
GeneralPredicate
- Creates and returns a copy of this object.
- Specified by:
copy in interface GeneralPredicate- Overrides:
copy in class GeneralPredicateProxy
- Following copied from interface:
net.sf.molae.logic.basic.GeneralPredicate
- Returns:
- a clone of this instance.
implies
public boolean implies(GeneralPredicate p)
- Tests if this predicate implies the specified predicate.
- Specified by:
implies in interface GeneralPredicate- Overrides:
implies in class GeneralPredicateProxy
- Parameters:
p - predicate to be checked for implication in this predicate- Returns:
- true if this predicate implies the specified predicate.
- Throws:
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.
not
public GeneralPredicate not()
- Description copied from interface:
SinglePredicate
- Returns the negation of this predicate.
- Specified by:
not in interface SinglePredicate- Overrides:
not in class GeneralPredicateProxy
- Following copied from interface:
net.sf.molae.logic.basic.SinglePredicate
- Returns:
- the negation of this predicate.
compute
protected Object compute(BinaryFunction operator,
GeneralPredicate p)
- Description copied from class:
GeneralPredicateProxy
- Placeholder for common implementation of all binary operations.
(Binary operations are
GeneralPredicateProxy.implies(net.sf.molae.logic.basic.GeneralPredicate, net.sf.molae.logic.basic.GeneralPredicate), GeneralPredicateProxy.and(net.sf.molae.logic.basic.GeneralPredicate), GeneralPredicateProxy.andNot(net.sf.molae.logic.basic.GeneralPredicate),
GeneralPredicateProxy.or(net.sf.molae.logic.basic.GeneralPredicate) and GeneralPredicateProxy.xor(net.sf.molae.logic.basic.GeneralPredicate).)
- Overrides:
compute in class GeneralPredicateProxy
- Following copied from class:
net.sf.molae.logic.basic.GeneralPredicateProxy
- Parameters:
operator - the operation to performp - predicate to be conjoined with this predicate- Returns:
- the result of the computation
- Throws:
ClassCastException - if the result of the operation
is not defined.IllegalArgumentException - if the result of the operation
is not defined.NullPointerException - if p is null.