KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > IntOrders


1 /*****************************************************************************
2  * Copyright (C) Zephyr Business Solutions Corp. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8 /*
9  * Created on Nov 29, 2004
10  *
11  * Author Ben Yu
12  */

13 package jfun.parsec;
14
15 /**
16  * Provide some common IntOrder implementations.
17  * @author Ben Yu
18  *
19  * Nov 29, 2004
20  */

21 final class IntOrders {
22   private static final IntOrder _lt = new IntOrder(){
23     public boolean compare(int a, int b){return a<b;}
24   };
25   private static final IntOrder _gt = new IntOrder(){
26     public boolean compare(int a, int b){return a>b;}
27   };
28   /**
29    * An IntOrder instance that determines if the first integer is less than the second one.
30    * lt().compare(1,2) == true.
31    * @return the IntOrder instance.
32    */

33   public static IntOrder lt(){return _lt;}
34   /**
35    * An IntOrder instance that determines if the first integer is greater than the second one.
36    * @return the IntOrder instance.
37    */

38   public static IntOrder gt(){return _gt;}
39 }
40
Popular Tags