@Test public void compareTo() { BooleanOption a = new BooleanOption(); BooleanOption b = new BooleanOption(); BooleanOption c = new BooleanOption(); a.modify(false); b.modify(true); c.modify(false); assertThat(compare(a, b), lessThan(0)); assertThat(compare(b, a), greaterThan(0)); assertThat(compare(a, c), is(0)); }
@Override public int compareTo(WritableRawComparable o) { BooleanOption other = (BooleanOption) o; if (nullValue | other.nullValue) { if (nullValue & other.nullValue) { return 0; } return nullValue ? -1 : +1; } if (value ^ other.value) { return value ? 1 : -1; } return 0; }
BooleanOption extends ValueOption<BooleanOption> { @Override public int compareTo(WritableRawComparable o) { BooleanOption other = (BooleanOption) o; if (nullValue | other.nullValue) { if (nullValue & other.nullValue) { return 0; } return nullValue ? -1 : +1; } if (value ^ other.value) { return value ? 1 : -1; } return 0; } }
BooleanOption extends ValueOption<BooleanOption> { @Override public int compareTo(WritableRawComparable o) { BooleanOption other = (BooleanOption) o; if (nullValue | other.nullValue) { if (nullValue & other.nullValue) { return 0; } return nullValue ? -1 : +1; } if (value ^ other.value) { return value ? 1 : -1; } return 0; } BooleanOption();  BooleanOption(boolean value); }
BooleanOption extends ValueOption<BooleanOption> { @Override public int compareTo(WritableRawComparable o) { BooleanOption other = (BooleanOption) o; if (nullValue | other.nullValue) { if (nullValue & other.nullValue) { return 0; } return nullValue ? -1 : +1; } if (value ^ other.value) { return value ? 1 : -1; } return 0; } BooleanOption();  BooleanOption(boolean value); boolean get(); boolean or(boolean alternate); @Deprecated BooleanOption modify(boolean newValue); @Override @Deprecated void copyFrom(BooleanOption optionOrNull); @Override int hashCode(); @Override boolean equals(Object obj); boolean has(boolean other); @Override int compareTo(WritableRawComparable o); @Override String toString(); @Override void write(DataOutput out); @Override void readFields(DataInput in); @Override int restore(byte[] bytes, int offset, int limit); @Override int getSizeInBytes(byte[] buf, int offset); @Override int compareInBytes(byte[] b1, int o1, byte[] b2, int o2); static int getBytesLength(byte[] bytes, int offset, int length); static int compareBytes(
            byte[] b1, int s1, int l1,
            byte[] b2, int s2, int l2); }
BooleanOption extends ValueOption<BooleanOption> { @Override public int compareTo(WritableRawComparable o) { BooleanOption other = (BooleanOption) o; if (nullValue | other.nullValue) { if (nullValue & other.nullValue) { return 0; } return nullValue ? -1 : +1; } if (value ^ other.value) { return value ? 1 : -1; } return 0; } BooleanOption();  BooleanOption(boolean value); boolean get(); boolean or(boolean alternate); @Deprecated BooleanOption modify(boolean newValue); @Override @Deprecated void copyFrom(BooleanOption optionOrNull); @Override int hashCode(); @Override boolean equals(Object obj); boolean has(boolean other); @Override int compareTo(WritableRawComparable o); @Override String toString(); @Override void write(DataOutput out); @Override void readFields(DataInput in); @Override int restore(byte[] bytes, int offset, int limit); @Override int getSizeInBytes(byte[] buf, int offset); @Override int compareInBytes(byte[] b1, int o1, byte[] b2, int o2); static int getBytesLength(byte[] bytes, int offset, int length); static int compareBytes(
            byte[] b1, int s1, int l1,
            byte[] b2, int s2, int l2);  }