01: package uk.co.jezuk.mango.binarypredicates;
02:
03: /**
04: * <code>BinaryPredicate</code> that returns true if <code>x</code> is greater than <code>y</code>.
05: * <code>x</code> and <code>y</code> must implement the <code>java.lang.Comparable<code> interface.
06: * @author Jez Higgins, jez@jezuk.co.uk
07: * @version $Id: GreaterThan.java 51 2002-06-11 18:43:59Z jez $
08: */
09: public class GreaterThan implements uk.co.jezuk.mango.BinaryPredicate {
10: /**
11: * @return <code>true</code> if <code>x.compareTo(y) > 0</code>
12: */
13: public boolean test(Object x, Object y) {
14: if (x == null)
15: return false;
16: if (y == null)
17: return true;
18:
19: return ((Comparable) x).compareTo(y) > 0;
20: } // test
21: } // GreaterThan
|