D
- the (final) type of NumberDistance usedN
- the type of Number used (e.g. Double, Integer, Float, etc.)public abstract class NumberDistance<D extends NumberDistance<D,N>,N extends Number> extends AbstractDistance<D>
DOUBLE_PATTERN, INFINITY_PATTERN, INTEGER_PATTERN
Constructor and Description |
---|
NumberDistance()
Constructs a new NumberDistance object that represents the value argument.
|
Modifier and Type | Method and Description |
---|---|
byte |
byteValue()
Get the value as byte.
|
int |
compareTo(D other)
Compares this NumberDistance with the given NumberDistance wrt the
represented value.
|
abstract double |
doubleValue()
Get the value as double.
|
float |
floatValue()
Get the value as float.
|
abstract D |
fromDouble(double val)
Build a new instance from a double value.
|
abstract N |
getValue()
Returns the value of this NumberDistance.
|
int |
hashCode()
Returns the hash code for this NumberDistance, which is the hash code of
its value.
|
int |
intValue()
Get the value as int.
|
abstract long |
longValue()
Get the value as long.
|
(package private) abstract void |
setValue(N value)
Sets the value of this NumberDistance.
|
short |
shortValue()
Get the value as short.
|
String |
toString()
Returns a string representation of this NumberDistance.
|
equals, getPattern, isInfiniteDistance, isNullDistance, isUndefinedDistance, requiredInputPattern, testInputPattern
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
externalizableSize, infiniteDistance, minus, nullDistance, parseString, plus, undefinedDistance
readExternal, writeExternal
public NumberDistance()
public abstract D fromDouble(double val)
val
- Valuepublic int hashCode()
hashCode
in class AbstractDistance<D extends NumberDistance<D,N>>
public int compareTo(D other)
d1.compareTo(d2)
is the same as
Double.compare(d1.value.doubleValue(),
d2.value.doubleValue())
. Subclasses may need to overwrite this method if
necessary.other
- Other objectpublic final String toString()
public abstract N getValue()
abstract void setValue(N value)
value
- the value to be setpublic abstract double doubleValue()
public float floatValue()
public int intValue()
public abstract long longValue()
public short shortValue()
public byte byteValue()