public class MathUtilLimitedImpl extends AbstractLoggableComponent implements MathUtilLimited
| Constructor and Description |
|---|
MathUtilLimitedImpl()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
NumberType<? extends Number> |
getNumberType(Class<?> numericType)
This method gets the
NumberType for the given numericType. |
<NUMBER extends Number> |
getNumberTypeGeneric(Class<NUMBER> numericType)
This method gets the
NumberType for the given numericType. |
Number |
toSimplestNumber(Number value)
This method converts the given value to the simplest suitable
number-type. |
createLogger, doInitialize, getLoggerdoInitialized, getInitializationState, initializepublic NumberType<? extends Number> getNumberType(Class<?> numericType)
NumberType for the given numericType.getNumberType in interface MathUtilLimitednumericType - is the class reflecting a Number. It may be primitive (such as int.class). The signature is NOT bound to Number to make
it easy for the caller (e.g. Number.class.isAssignableFrom(int.class) is
false).NumberType representing the given numericType or null if
the given numericType is no Number or is NOT known (you may extend this
MathUtilLimited in such case).MathUtilLimited.getNumberTypeGeneric(Class)public <NUMBER extends Number> NumberType<NUMBER> getNumberTypeGeneric(Class<NUMBER> numericType)
NumberType for the given numericType.getNumberTypeGeneric in interface MathUtilLimitedNUMBER - is the generic type of the numericType.numericType - is the class reflecting a Number. It may be primitive (such as int.class).NumberType representing the given numericType or null if
the given numericType is NOT known (you may extend this MathUtilLimited in
such case).public Number toSimplestNumber(Number value)
number-type. The
ordering implied by "simplest" is Byte < Short < Integer < Long
< Float < Double. Double is only converted to Float if the result is exactly the
same. Be aware that 0.2F - 0.2 is NOT 0.0 (but
2.980232227667301E-9).toSimplestNumber in interface MathUtilLimitedvalue - is the value to convert.Number.doubleValue() as the given value and the simplest possible
type.Copyright © 2001–2015 mmm-Team. All rights reserved.