Class RJavaComparator

java.lang.Object
  extended by RJavaComparator

public class RJavaComparator
extends java.lang.Object

Utility class to compare two objects in the sense of the java.lang.Comparable interface


Constructor Summary
RJavaComparator()
           
 
Method Summary
static int compare(java.lang.Object a, java.lang.Object b)
          compares a and b in the sense of the java.lang.Comparable if possible instances of the Number interface are treated specially, in order to allow comparing Numbers of different classes, for example it is allowed to compare a Double with an Integer. if the Numbers have the same class, they are compared normally, otherwise they are first converted to Doubles and then compared
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RJavaComparator

public RJavaComparator()
Method Detail

compare

public static int compare(java.lang.Object a,
                          java.lang.Object b)
                   throws NotComparableException
compares a and b in the sense of the java.lang.Comparable if possible

instances of the Number interface are treated specially, in order to allow comparing Numbers of different classes, for example it is allowed to compare a Double with an Integer. if the Numbers have the same class, they are compared normally, otherwise they are first converted to Doubles and then compared

Parameters:
a - an object
b - another object
Returns:
the result of a.compareTo(b) if this makes sense
Throws:
NotComparableException - if the two objects are not comparable