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

edu.berkeley.guir.lib.collection
Class NumericalComparator

java.lang.Object
  |
  +--edu.berkeley.guir.lib.collection.NumericalComparator
All Implemented Interfaces:
Comparator

public class NumericalComparator
extends Object
implements Comparator

Compare Number objects.

This software is distributed under the Berkeley Software License.

 Revisions:  - GUIRLib-v1.0-1.0.0, Jun 16 1999, 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.2
Version:
GUIRLib-v1.4-1.0.0, Aug 31 2000
Author:
(jasonh@cs.berkeley.edu)

Constructor Summary
NumericalComparator()
           
 
Method Summary
 int compare(Object obj1, Object obj2)
           
 void setUsePerturbations(boolean flag)
          Add perturbations to the values or not? Basically, if set to true, we will add two different small values to each of the numbers before comparison, to avoid equal values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

NumericalComparator

public NumericalComparator()
Method Detail

setUsePerturbations

public void setUsePerturbations(boolean flag)
Add perturbations to the values or not? Basically, if set to true, we will add two different small values to each of the numbers before comparison, to avoid equal values.
Parameters:
flag - is true if perturbations are to be used, false otherwise.

compare

public int compare(Object obj1,
                   Object obj2)
Specified by:
compare in interface Comparator

Copyright Information