edu.northwestern.at.utils
Class Compare

java.lang.Object
  extended by edu.northwestern.at.utils.Compare

public class Compare
extends java.lang.Object

Comparison utilties.


Method Summary
static int compare(byte b1, byte b2)
          Compares two bytes.
static int compare(java.util.Date d1, java.util.Date d2)
          Compares two dates.
static int compare(double d1, double d2)
          Compares two doubles.
static int compare(java.lang.Double d1, java.lang.Double d2)
          Compares two Doubles.
static int compare(java.lang.Integer n1, java.lang.Integer n2)
          Compares two Integers.
static int compare(int n1, int n2)
          Compares two ints.
static int compare(long n1, long n2)
          Compares two longs.
static int compare(java.lang.Long n1, java.lang.Long n2)
          Compares two Longs.
static int compare(java.lang.String s1, java.lang.String s2)
          Compares two case-sensitive strings.
static int compareIgnoreCase(java.lang.String s1, java.lang.String s2)
          Compares two case-insensitive strings.
static boolean equals(java.lang.Object o1, java.lang.Object o2)
          Returns true if two objects are equal.
static boolean equalsIgnoreCase(java.lang.String s1, java.lang.String s2)
          Returns true if two case-insensitive strings are equal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equalsIgnoreCase

public static boolean equalsIgnoreCase(java.lang.String s1,
                                       java.lang.String s2)
Returns true if two case-insensitive strings are equal.

Nulls are permitted and are equal only to themselves.

Parameters:
s1 - String 1.
s2 - String 2.
Returns:
True if s1 = s2 ignoring case.

equals

public static boolean equals(java.lang.Object o1,
                             java.lang.Object o2)
Returns true if two objects are equal.

Nulls are permitted and are equal only to themselves.

Parameters:
o1 - Object 1.
o2 - Object 2.
Returns:
True if o1 = o2.

compare

public static int compare(java.lang.String s1,
                          java.lang.String s2)
Compares two case-sensitive strings.

Nulls are permitted and are less than non-nulls.

Parameters:
s1 - String 1.
s2 - String 2.
Returns:
< 0 if s1 < s2, 0 if s1 = s2, > 0 if s1 > s2.

compareIgnoreCase

public static int compareIgnoreCase(java.lang.String s1,
                                    java.lang.String s2)
Compares two case-insensitive strings.

Nulls are permitted and are less than non-nulls.

Parameters:
s1 - String 1.
s2 - String 2.
Returns:
< 0 if s1 < s2, 0 if s1 = s2, > 0 if s1 > s2.

compare

public static int compare(java.util.Date d1,
                          java.util.Date d2)
Compares two dates.

Nulls are permitted and are less than non-nulls.

Parameters:
d1 - Date 1.
d2 - Date 2.
Returns:
< 0 if d1 < d2, 0 if d1 = d2, > 0 if d1 > d2.

compare

public static int compare(int n1,
                          int n2)
Compares two ints.

Parameters:
n1 - Int 1.
n2 - Int 2.
Returns:
-1 if n1 < n2, 0 if n1 = n2, +1 if n1 > n2.

compare

public static int compare(long n1,
                          long n2)
Compares two longs.

Parameters:
n1 - Long 1.
n2 - Long 2.
Returns:
-1 if n1 < n2, 0 if n1 = n2, +1 if n1 > n2.

compare

public static int compare(double d1,
                          double d2)
Compares two doubles.

Parameters:
d1 - double 1.
d2 - double 2.
Returns:
-1 if d1 < d2, 0 if d1 = d2, +1 if d1 > d2.

compare

public static int compare(java.lang.Integer n1,
                          java.lang.Integer n2)
Compares two Integers.

Nulls are permitted and are less than non-nulls.

Parameters:
n1 - Integer 1.
n2 - Integer 2.
Returns:
-1 if n1 < n2, 0 if n1 = n2, +1 if n1 > n2.

compare

public static int compare(java.lang.Long n1,
                          java.lang.Long n2)
Compares two Longs.

Nulls are permitted and are less than non-nulls.

Parameters:
n1 - Long 1.
n2 - Long 2.
Returns:
-1 if n1 < n2, 0 if n1 = n2, +1 if n1 > n2.

compare

public static int compare(java.lang.Double d1,
                          java.lang.Double d2)
Compares two Doubles.

Nulls are permitted and are less than non-nulls.

Parameters:
d1 - Double 1.
d2 - Double 2.
Returns:
-1 if d1 < d2, 0 if d1 = d2, +1 if d1 > d2.

compare

public static int compare(byte b1,
                          byte b2)
Compares two bytes.

Nulls are permitted and are less than non-nulls.

Parameters:
b1 - byte 1.
b2 - byte 2.
Returns:
-1 if b1 < b2, 0 if b1 = b2, +1 if b1 > b2.