KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > uk > co > jezuk > mango > binarypredicates > GreaterThan


1 package uk.co.jezuk.mango.binarypredicates;
2
3 /**
4  * <code>BinaryPredicate</code> that returns true if <code>x</code> is greater than <code>y</code>.
5  * <code>x</code> and <code>y</code> must implement the <code>java.lang.Comparable<code> interface.
6  * @author Jez Higgins, jez@jezuk.co.uk
7  * @version $Id: GreaterThan.java 51 2002-06-11 18:43:59Z jez $
8  */

9 public class GreaterThan implements uk.co.jezuk.mango.BinaryPredicate
10 {
11   /**
12    * @return <code>true</code> if <code>x.compareTo(y) &gt; 0</code>
13    */

14   public boolean test(Object JavaDoc x, Object JavaDoc y)
15   {
16     if(x == null)
17       return false;
18     if(y == null)
19       return true;
20
21     return ((Comparable JavaDoc)x).compareTo(y) > 0;
22   } // test
23
} // GreaterThan
24

25
Popular Tags