uk.co.jezuk.mango
Class BinaryPredicates

java.lang.Object
  extended by uk.co.jezuk.mango.BinaryPredicates

public class BinaryPredicates
extends java.lang.Object

The Mango Library Binary Predicates

A BinaryPredicate is some function taking two arguments - fn(x, y) and returning the result of some test. It returns true if the conditions of the test are satisfied, false otherwise

Author:
Jez Higgins, jez@jezuk.co.uk
See Also:
BinaryPredicate

Method Summary
static
<T1,T2> BinaryPredicate<T1,T2>
And(BinaryPredicate<T1,T2> pred1, BinaryPredicate<T1,T2> pred2)
          A BinaryPredicate which returns the logical AND of two other BinaryPredicate.
static
<T1,T2> BinaryPredicate<T1,T2>
Constant(boolean constant)
          A BinaryPredicate which returns a precomputed constant value
static
<T1,T2> BinaryPredicate<T1,T2>
EqualTo()
          BinaryPredicate testing for equality.
static
<T1,T2> BinaryPredicate<T1,T2>
False()
          BinaryPredicates that always returns false
static
<T1,T2> BinaryPredicate<T1,T2>
GreaterThan()
          BinaryPredicate that returns true if x is greater than y.
static
<T1,T2> BinaryPredicate<T1,T2>
GreaterThanEquals()
          BinaryPredicate that returns true if x is greater than or equal to y.
static
<T1,T2> BinaryPredicate<T1,T2>
LessThan()
          BinaryPredicate that returns true if x is less than y.
static
<T1,T2> BinaryPredicate<T1,T2>
LessThanEquals()
          BinaryPredicate that returns true if x is less than or equal to y.
static
<T1,T2> BinaryPredicate<T1,T2>
Not(BinaryPredicate<T1,T2> pred)
          A BinaryPredicate which is the logical negation of some other BinaryPredicate.
static
<T1,T2> BinaryPredicate<T1,T2>
NotEqualTo()
          true if not(x.equals(y)), (x == null) && not(y == null) or not(x == null) && (y == null)
static
<T1,T2> BinaryPredicate<T1,T2>
Or(BinaryPredicate<T1,T2> pred1, BinaryPredicate<T1,T2> pred2)
          A BinaryPredicate which returns the logical OR of two other BinaryPredicate.
static
<T1,T2> BinaryPredicate<T1,T2>
True()
          BinaryPredicates that always returns true
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

True

public static <T1,T2> BinaryPredicate<T1,T2> True()
BinaryPredicates that always returns true


False

public static <T1,T2> BinaryPredicate<T1,T2> False()
BinaryPredicates that always returns false


Constant

public static <T1,T2> BinaryPredicate<T1,T2> Constant(boolean constant)
A BinaryPredicate which returns a precomputed constant value


EqualTo

public static <T1,T2> BinaryPredicate<T1,T2> EqualTo()
BinaryPredicate testing for equality. true if x.equals(y) or (x == null && y == null)


GreaterThan

public static <T1,T2> BinaryPredicate<T1,T2> GreaterThan()
BinaryPredicate that returns true if x is greater than y. x and y must implement the java.lang.Comparable interface.


GreaterThanEquals

public static <T1,T2> BinaryPredicate<T1,T2> GreaterThanEquals()
BinaryPredicate that returns true if x is greater than or equal to y. x and y must implement the java.lang.Comparable interface.


LessThan

public static <T1,T2> BinaryPredicate<T1,T2> LessThan()
BinaryPredicate that returns true if x is less than y. x and y must implement the java.lang.Comparable interface.


LessThanEquals

public static <T1,T2> BinaryPredicate<T1,T2> LessThanEquals()
BinaryPredicate that returns true if x is less than or equal to y. x and y must implement the java.lang.Comparable interface.


NotEqualTo

public static <T1,T2> BinaryPredicate<T1,T2> NotEqualTo()
true if not(x.equals(y)), (x == null) && not(y == null) or not(x == null) && (y == null)


Not

public static <T1,T2> BinaryPredicate<T1,T2> Not(BinaryPredicate<T1,T2> pred)
A BinaryPredicate which is the logical negation of some other BinaryPredicate. If n is a Not object, and pred is the Predicate it was constructed with, then n.test(x,y) returns !pred.test(x,y).


And

public static <T1,T2> BinaryPredicate<T1,T2> And(BinaryPredicate<T1,T2> pred1,
                                                 BinaryPredicate<T1,T2> pred2)
A BinaryPredicate which returns the logical AND of two other BinaryPredicate. If a is an And object, constructed with pred1 and pred2, then a.test(x,y) returns pred1.test(x,y) && pred2.test(x,y)


Or

public static <T1,T2> BinaryPredicate<T1,T2> Or(BinaryPredicate<T1,T2> pred1,
                                                BinaryPredicate<T1,T2> pred2)
A BinaryPredicate which returns the logical OR of two other BinaryPredicate. If a is an Or object, constructed with pred1 and pred2, then a.test(x,y) returns pred1.test(x,y) || pred2.test(x,y)



Copyright 2002-2010 JezUK Ltd.