uk.co.jezuk.mango
Class Predicates

java.lang.Object
  extended byuk.co.jezuk.mango.Predicates

public class Predicates
extends java.lang.Object

The Mango Library Unary and Binary Predicates

Version:
$Id: Predicates.java 80 2003-04-03 12:44:26Z jez $
Author:
Jez Higgins, jez@jezuk.co.uk

Method Summary
static BinaryPredicate And(BinaryPredicate pred1, BinaryPredicate pred2)
          A BinaryPredicate which returns the logical AND of two other BinaryPredicate.
static Predicate And(Predicate pred1, Predicate pred2)
          A Predicate which returns the logical AND of two other Predicate.
static BinaryPredicate EqualTo()
          BinaryPredicate testing for equality.
static Predicate False()
          A Predicate which always returns false
static BinaryPredicate GreaterThan()
          BinaryPredicate that returns true if x is greater than y.
static BinaryPredicate GreaterThanEquals()
          BinaryPredicate that returns true if x is greater than or equal to y.
static BinaryPredicate LessThan()
          BinaryPredicate that returns true if x is less than y.
static BinaryPredicate LessThanEquals()
          BinaryPredicate that returns true if x is less than or equal to y.
static BinaryPredicate Not(BinaryPredicate pred)
          A BinaryPredicate which is the logical negation of some other BinaryPredicate.
static Predicate Not(Predicate pred)
          A Predicate which is the logical negation of some other Predicate.
static BinaryPredicate NotEqualTo()
          true if not(x.equals(y)), (x == null) && not(y == null) or not(x == null) && (y == null)
static BinaryPredicate Or(BinaryPredicate pred1, BinaryPredicate pred2)
          A BinaryPredicate which returns the logical OR of two other BinaryPredicate.
static Predicate Or(Predicate pred1, Predicate pred2)
          A Predicate which returns the logical OR of two other Predicate.
static Predicate True()
          A Predicate which 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 Predicate True()
A Predicate which always returns true


False

public static Predicate False()
A Predicate which always returns false


Not

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


And

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


Or

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


EqualTo

public static BinaryPredicate EqualTo()
BinaryPredicate testing for equality. true if x.equals(y) or (x == null && y == null)


GreaterThan

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


GreaterThanEquals

public static BinaryPredicate 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 BinaryPredicate LessThan()
BinaryPredicate that returns true if x is less than y. x and y must implement the java.lang.Comparable interface.


LessThanEquals

public static BinaryPredicate 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 BinaryPredicate NotEqualTo()
true if not(x.equals(y)), (x == null) && not(y == null) or not(x == null) && (y == null)


Not

public static BinaryPredicate Not(BinaryPredicate 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 BinaryPredicate And(BinaryPredicate pred1,
                                  BinaryPredicate 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 BinaryPredicate Or(BinaryPredicate pred1,
                                 BinaryPredicate 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-2006 JezUK Ltd.