Package org.tensorics.core.math
Class BinaryPredicates
- java.lang.Object
-
- org.tensorics.core.math.BinaryPredicates
-
public final class BinaryPredicates extends java.lang.ObjectProvides utility methods for binary predicates
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> BinaryPredicate<T>and(BinaryPredicate<T> leftPredicate, BinaryPredicate<T> rightPredicate)Returns a logical 'and' combination of the two binary predicates.static <T> BinaryPredicate<T>invert(BinaryPredicate<T> original)Inverts the given binary predicate.static <T> BinaryPredicate<T>not(BinaryPredicate<T> original)Negates the given binary predicate.
-
-
-
Method Detail
-
not
public static <T> BinaryPredicate<T> not(BinaryPredicate<T> original)
Negates the given binary predicate. Thus, theBinaryPredicate.test(Object, Object)will return the logically negated value of the original. For example, if the predicate is'<=', then this method will transform the predicate(a <= b) to !(a <= b), which is equivalent to(a > b).- Parameters:
original- the original predicate.- Returns:
-
invert
public static <T> BinaryPredicate<T> invert(BinaryPredicate<T> original)
Inverts the given binary predicate. Thus, if e.g. the predicate is'<=', then this method will transform the predicate(a <= b)to(a >= b).- Parameters:
original- the original predicate.- Returns:
- the inverted predicate.
-
and
public static <T> BinaryPredicate<T> and(BinaryPredicate<T> leftPredicate, BinaryPredicate<T> rightPredicate)
Returns a logical 'and' combination of the two binary predicates. Thus, the resulting predicate will only be fulfilled as soon as both predicate test methods return true.- Parameters:
leftPredicate- the first predicate which shall be part of the and conditionrightPredicate- the second predicate which shall be part of the and condition- Returns:
- a predicate which represents a logical 'AND' between the two predicates
-
-