@Test public void compareTo() { DecimalOption a = new DecimalOption(); DecimalOption b = new DecimalOption(); DecimalOption c = new DecimalOption(); DecimalOption d = new DecimalOption(); DecimalOption e = new DecimalOption(); a.modify(decimal(-10)); b.modify(decimal(0)); c.modify(decimal(50)); d.modify(decimal(-10)); e.modify(decimal(-30)); assertThat(compare(a, b), lessThan(0)); assertThat(compare(b, c), lessThan(0)); assertThat(compare(c, a), greaterThan(0)); assertThat(compare(a, c), lessThan(0)); assertThat(compare(b, a), greaterThan(0)); assertThat(compare(c, b), greaterThan(0)); assertThat(compare(a, d), is(0)); assertThat(compare(a, e), greaterThan(0)); }
@Override public int compareTo(WritableRawComparable o) { DecimalOption other = (DecimalOption) o; if (nullValue | other.nullValue) { if (nullValue & other.nullValue) { return 0; } return nullValue ? -1 : +1; } return entity.compareTo(other.entity); }
DecimalOption extends ValueOption<DecimalOption> { @Override public int compareTo(WritableRawComparable o) { DecimalOption other = (DecimalOption) o; if (nullValue | other.nullValue) { if (nullValue & other.nullValue) { return 0; } return nullValue ? -1 : +1; } return entity.compareTo(other.entity); } }
DecimalOption extends ValueOption<DecimalOption> { @Override public int compareTo(WritableRawComparable o) { DecimalOption other = (DecimalOption) o; if (nullValue | other.nullValue) { if (nullValue & other.nullValue) { return 0; } return nullValue ? -1 : +1; } return entity.compareTo(other.entity); } DecimalOption();  DecimalOption(BigDecimal valueOrNull); }
DecimalOption extends ValueOption<DecimalOption> { @Override public int compareTo(WritableRawComparable o) { DecimalOption other = (DecimalOption) o; if (nullValue | other.nullValue) { if (nullValue & other.nullValue) { return 0; } return nullValue ? -1 : +1; } return entity.compareTo(other.entity); } DecimalOption();  DecimalOption(BigDecimal valueOrNull); BigDecimal get(); BigDecimal or(BigDecimal alternate); void add(BigDecimal delta); void add(DecimalOption other); @Deprecated DecimalOption modify(BigDecimal newValue); @Override @Deprecated void copyFrom(DecimalOption optionOrNull); @Override int hashCode(); @Override boolean equals(Object obj); boolean has(BigDecimal other); @Override int compareTo(WritableRawComparable o); @Override String toString(); @Override void write(DataOutput out); @SuppressWarnings("deprecation") @Override void readFields(DataInput in); @SuppressWarnings("deprecation") @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); }
DecimalOption extends ValueOption<DecimalOption> { @Override public int compareTo(WritableRawComparable o) { DecimalOption other = (DecimalOption) o; if (nullValue | other.nullValue) { if (nullValue & other.nullValue) { return 0; } return nullValue ? -1 : +1; } return entity.compareTo(other.entity); } DecimalOption();  DecimalOption(BigDecimal valueOrNull); BigDecimal get(); BigDecimal or(BigDecimal alternate); void add(BigDecimal delta); void add(DecimalOption other); @Deprecated DecimalOption modify(BigDecimal newValue); @Override @Deprecated void copyFrom(DecimalOption optionOrNull); @Override int hashCode(); @Override boolean equals(Object obj); boolean has(BigDecimal other); @Override int compareTo(WritableRawComparable o); @Override String toString(); @Override void write(DataOutput out); @SuppressWarnings("deprecation") @Override void readFields(DataInput in); @SuppressWarnings("deprecation") @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);  }