UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.util
Class NumComparison

java.lang.Object
  |
  +--edu.berkeley.guir.lib.util.NumComparison
All Implemented Interfaces:
Comparison

public class NumComparison
extends Object
implements Comparison

Allows comparisons between arbitrary number objects.

This software is distributed under the Berkeley Software License.

 Revisions:  - GUIRLib-v1.0-1.0.0, Nov 25 1997, JH
               Created class
             - GUIRLib-v1.2-1.0.0, Jun 22 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH
               Touched for GUIRLib release
 

Since:
JDK 1.1.4
Version:
GUIRLib-v1.4-1.0.0, Aug 31 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu)

Constructor Summary
NumComparison()
           
 
Method Summary
 boolean isEqual(Object obj1, Object obj2)
          Sees if two Numbers are "equal" or not.
 boolean isGreaterThan(Object obj1, Object obj2)
          Sees if the first Number is "greater than" the second Number.
 boolean isGreaterThanOrEqual(Object obj1, Object obj2)
          Sees if the first Number is "greater than or equal" to the second Number.
 boolean isLessThan(Object obj1, Object obj2)
          Sees if the first Number is "less than" the second Number.
 boolean isLessThanOrEqual(Object obj1, Object obj2)
          Sees if the first Number is "less than or equal" to the second Number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumComparison

public NumComparison()
Method Detail

isEqual

public boolean isEqual(Object obj1,
                       Object obj2)
Sees if two Numbers are "equal" or not.
Specified by:
isEqual in interface Comparison
Parameters:
obj1 - is some Object to be compared to obj2.
obj2 - is some Object to be compared to obj1.
Returns:
true if the two objects are "equal", false otherwise.
Throws:
NumberFormatException - if either one is not a Number.

isLessThan

public boolean isLessThan(Object obj1,
                          Object obj2)
Sees if the first Number is "less than" the second Number.
Specified by:
isLessThan in interface Comparison
Parameters:
obj1 - is some Object to be compared to obj2.
obj2 - is some Object to be compared to obj1.
Returns:
true if obj1 is "less than" obj2.
Throws:
NumberFormatException - if either one is not a Number.

isLessThanOrEqual

public boolean isLessThanOrEqual(Object obj1,
                                 Object obj2)
Sees if the first Number is "less than or equal" to the second Number.
Specified by:
isLessThanOrEqual in interface Comparison
Parameters:
obj1 - is some Object to be compared to obj2.
obj2 - is some Object to be compared to obj1.
Returns:
true if obj1 is "less than or equal" to obj2.
Throws:
NumberFormatException - if either one is not a Number.

isGreaterThan

public boolean isGreaterThan(Object obj1,
                             Object obj2)
Sees if the first Number is "greater than" the second Number.
Specified by:
isGreaterThan in interface Comparison
Parameters:
obj1 - is some Object to be compared to obj2.
obj2 - is some Object to be compared to obj1.
Returns:
true if obj1 is "greater than" obj2.
Throws:
NumberFormatException - if either one is not a Number.

isGreaterThanOrEqual

public boolean isGreaterThanOrEqual(Object obj1,
                                    Object obj2)
Sees if the first Number is "greater than or equal" to the second Number.
Specified by:
isGreaterThanOrEqual in interface Comparison
Parameters:
obj1 - is some Object to be compared to obj2.
obj2 - is some Object to be compared to obj1.
Returns:
true if obj1 is "greater than or equal" to obj2.
Throws:
NumberFormatException - if either one is not a Number.

Copyright Information