KickJava   Java API By Example, From Geeks To Geeks.

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


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

9 public class LessThanEquals implements uk.co.jezuk.mango.BinaryPredicate
10 {
11   /**
12    * @return <code>true</code> if <code>x.compareTo(y) &lt; 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 true;
20     if(y == null)
21       return false;
22
23     return ((Comparable JavaDoc)x).compareTo(y) <= 0;
24   } // test
25
} // LessThanEquals
26

27
Popular Tags