public class NumberTolerantDataType extends NumberDataType
NumberDataType
. Extends the
AbstractDataType.compare(Object, Object)
method in order to respect precision tolerance.
This is comparable to the JUnit method
assert(double val1, double val2, double toleratedDelta)
.BIGINT, BIGINT_AUX_LONG, BINARY, BIT, BLOB, BOOLEAN, CHAR, CLOB, DATE, DECIMAL, DOUBLE, FLOAT, INTEGER, LONGNVARCHAR, LONGVARBINARY, LONGVARCHAR, NCHAR, NUMERIC, NVARCHAR, REAL, SMALLINT, TIME, TIMESTAMP, TINYINT, UNKNOWN, VARBINARY, VARCHAR
Modifier and Type | Method and Description |
---|---|
protected int |
compareNonNulls(Object value1cast,
Object value2cast)
The only method overwritten from the base implementation to compare numbers allowing a tolerance
|
ToleratedDeltaMap.Precision |
getToleratedDelta() |
static boolean |
isZero(BigDecimal value)
Checks if the given value is zero.
|
getSqlValue, setSqlValue, typeCast
areObjectsEqual, compare, getSqlType, getTypeClass, isDateTime, isNumber, loadClass, loadClass, toString
asString, forObject, forSqlType, forSqlTypeName
public ToleratedDeltaMap.Precision getToleratedDelta()
protected int compareNonNulls(Object value1cast, Object value2cast) throws TypeCastException
compareNonNulls
in class AbstractDataType
value1cast
- First value resulting from the DataType.typeCast(Object)
method callvalue2cast
- Second value resulting from the DataType.typeCast(Object)
method callComparable.compareTo(Object)
invocation.TypeCastException
AbstractDataType.compareNonNulls(java.lang.Object, java.lang.Object)
public static final boolean isZero(BigDecimal value)
value
- true
if and only if the given value is zero.Copyright © 2002–2017. All rights reserved.