DecimalType extends Number implements PrimitiveType, State, Command, Comparable<DecimalType> { @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof DecimalType)) { return false; } DecimalType other = (DecimalType) obj; return value.compareTo(other.value) == 0; } DecimalType();  DecimalType(BigDecimal value);  DecimalType(long value);  DecimalType(double value);  DecimalType(String value); @Override String toString(); @Override String toFullString(); static DecimalType valueOf(String value); @Override String format(String pattern); BigDecimal toBigDecimal(); @Override int hashCode(); @Override boolean equals(@Nullable Object obj); @Override int compareTo(DecimalType o); @Override double doubleValue(); @Override float floatValue(); @Override int intValue(); @Override long longValue(); @Override T as(@Nullable Class<T> target); static final DecimalType ZERO; }
@Test public void testEquals() { DecimalType dt1 = new DecimalType("142.8"); DecimalType dt2 = new DecimalType("142.8"); DecimalType dt3 = new DecimalType("99.7"); PercentType pt = new PercentType("99.7"); assertTrue(dt1.equals(dt2)); assertFalse(dt1.equals(dt3)); assertTrue(dt3.equals(pt)); assertFalse(dt1.equals(pt)); }