Ejemplo n.º 1
0
 @Override
 public int hashCode() {
   int result = 1;
   for (int i = start; i < end; i++) {
     result = 31 * result + Booleans.hashCode(array[i]);
   }
   return result;
 }
    public int hashCode()
    {
        int j = 1;
        for (int i = start; i < end; i++)
        {
            j = j * 31 + Booleans.hashCode(array[i]);
        }

        return j;
    }
Ejemplo n.º 3
0
 @Override
 public int lastIndexOf(Object target) {
   // Overridden to prevent a ton of boxing
   if (target instanceof Boolean) {
     int i = Booleans.lastIndexOf(array, (Boolean) target, start, end);
     if (i >= 0) {
       return i - start;
     }
   }
   return -1;
 }
Ejemplo n.º 4
0
 @Override
 public int compare(boolean[] left, boolean[] right) {
   int minLength = Math.min(left.length, right.length);
   for (int i = 0; i < minLength; i++) {
     int result = Booleans.compare(left[i], right[i]);
     if (result != 0) {
       return result;
     }
   }
   return left.length - right.length;
 }
 public int lastIndexOf(Object obj)
 {
     if (obj instanceof Boolean)
     {
         int i = Booleans.access$100(array, ((Boolean)obj).booleanValue(), start, end);
         if (i >= 0)
         {
             return i - start;
         }
     }
     return -1;
 }
Ejemplo n.º 6
0
 protected final int compare(int index1, int index2) {
   final boolean n1 = nulls.get(index1);
   final boolean n2 = nulls.get(index2);
   if (n1 && n2) {
     return 0;
   }
   if (n1 ^ n2) {
     return nullsFirst ? (n1 ? -1 : 1) : (n1 ? 1 : -1);
   }
   int compare;
   switch (type) {
     case 0:
       compare = Booleans.compare(booleans[index1], booleans[index2]);
       break;
     case 1:
       compare = bits[index1] - bits[index2];
       break;
     case 2:
       compare = Shorts.compare(shorts[index1], shorts[index2]);
       break;
     case 3:
       compare = Ints.compare(ints[index1], ints[index2]);
       break;
     case 4:
       compare = Longs.compare(longs[index1], longs[index2]);
       break;
     case 5:
       compare = Floats.compare(floats[index1], floats[index2]);
       break;
     case 6:
       compare = Doubles.compare(doubles[index1], doubles[index2]);
       break;
     case 7:
       compare = TextDatum.COMPARATOR.compare(bytes[index1], bytes[index2]);
       break;
     case 8:
       compare = UnsignedInts.compare(ints[index1], ints[index2]);
       break;
     default:
       throw new IllegalArgumentException();
   }
   return ascending ? compare : -compare;
 }
 public boolean contains(Object obj)
 {
     return (obj instanceof Boolean) && Booleans.access$000(array, ((Boolean)obj).booleanValue(), start, end) != -1;
 }
Ejemplo n.º 8
0
 @Override
 public boolean contains(Object target) {
   // Overridden to prevent a ton of boxing
   return (target instanceof Boolean)
       && Booleans.indexOf(array, (Boolean) target, start, end) != -1;
 }
 @Override
 public int compareTo(@Nonnull EncodedValue o) {
   int res = Ints.compare(getValueType(), o.getValueType());
   if (res != 0) return res;
   return Booleans.compare(getValue(), ((BooleanEncodedValue) o).getValue());
 }