Esempio n. 1
0
 /**
  * Check whether the two values are equal.
  *
  * @param a the first value
  * @param b the second value
  * @return true if they are equal
  */
 public boolean areValuesEqual(Object a, Object b) {
   if (a == b) {
     return true;
   } else if (a == null || b == null) {
     return false;
   }
   return valueType.compare(a, b) == 0;
 }
Esempio n. 2
0
 @Override
 public int compare(Object aObj, Object bObj) {
   if (aObj == bObj) {
     return 0;
   }
   Object[] a = (Object[]) aObj;
   Object[] b = (Object[]) bObj;
   for (int i = 0; i < arrayLength; i++) {
     DataType t = elementTypes[i];
     int comp = t.compare(a[i], b[i]);
     if (comp != 0) {
       return comp;
     }
   }
   return 0;
 }
Esempio n. 3
0
 /**
  * Compare two keys.
  *
  * @param a the first key
  * @param b the second key
  * @return -1 if the first key is smaller, 1 if bigger, 0 if equal
  */
 int compare(Object a, Object b) {
   return keyType.compare(a, b);
 }