KickJava   Java API By Example, From Geeks To Geeks.

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


1 package uk.co.jezuk.mango.binarypredicates;
2
3 /**
4  * <code>BinaryPredicate</code> that returns true if <code>x</code> is greater than or equal to <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: GreaterThanEquals.java 51 2002-06-11 18:43:59Z jez $
8  */

9 public class GreaterThanEquals 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) && (y == null))
17       return true;
18     if(x == null)
19       return false;
20     if(y == null)
21       return true;
22
23     return ((Comparable JavaDoc)x).compareTo(y) >= 0;
24   } // test
25
} // GreaterThanEquals
26

27
Popular Tags