public class IntegerDistance extends NumberDistance<IntegerDistance,Integer>
Modifier and Type | Field and Description |
---|---|
static IntegerDistance |
FACTORY
The static factory instance
|
private static long |
serialVersionUID
Created serial version UID.
|
(package private) int |
value
The distance value
|
DOUBLE_PATTERN, INFINITY_PATTERN, INTEGER_PATTERN
Constructor and Description |
---|
IntegerDistance()
Empty constructor for serialization purposes.
|
IntegerDistance(int value)
Constructor
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(IntegerDistance other)
Compares this NumberDistance with the given NumberDistance wrt the
represented value.
|
double |
doubleValue()
Get the value as double.
|
int |
externalizableSize()
Returns the number of Bytes this distance uses if it is written to an
external file.
|
IntegerDistance |
fromDouble(double val)
Build a new instance from a double value.
|
Pattern |
getPattern()
Get the pattern accepted by this distance
|
Integer |
getValue()
Returns the value of this NumberDistance.
|
IntegerDistance |
infiniteDistance()
Provides an infinite distance.
|
int |
intValue()
Get the value as int.
|
boolean |
isInfiniteDistance()
Returns true, if the distance is an infinite distance, false otherwise.
|
boolean |
isNullDistance()
Returns true, if the distance is a null distance, false otherwise.
|
boolean |
isUndefinedDistance()
Returns true, if the distance is an undefined distance, false otherwise.
|
long |
longValue()
Get the value as long.
|
IntegerDistance |
minus(IntegerDistance distance)
Returns a new Distance by subtracting the given distance from this
distance.
|
IntegerDistance |
nullDistance()
Provides a null distance.
|
IntegerDistance |
parseString(String val)
Provides a measurement suitable to this measurement function based on the
given pattern.
|
IntegerDistance |
plus(IntegerDistance distance)
Returns a new distance as sum of this distance and the given distance.
|
void |
readExternal(ObjectInput in)
Reads the integer value of this IntegerDistance from the specified stream.
|
(package private) void |
setValue(Integer value)
Sets the value of this NumberDistance.
|
IntegerDistance |
undefinedDistance()
Provides an undefined distance.
|
void |
writeExternal(ObjectOutput out)
Writes the integer value of this IntegerDistance to the specified stream.
|
byteValue, floatValue, hashCode, shortValue, toString
equals, requiredInputPattern, testInputPattern
public static final IntegerDistance FACTORY
int value
private static final long serialVersionUID
public IntegerDistance()
public IntegerDistance(int value)
value
- distance valuepublic IntegerDistance fromDouble(double val)
NumberDistance
fromDouble
in class NumberDistance<IntegerDistance,Integer>
val
- Valuepublic IntegerDistance minus(IntegerDistance distance)
Distance
distance
- the distance to be subtracted from this distancepublic IntegerDistance plus(IntegerDistance distance)
Distance
distance
- the distance to be added to this distancepublic void writeExternal(ObjectOutput out) throws IOException
IOException
public void readExternal(ObjectInput in) throws IOException
IOException
public int externalizableSize()
public Integer getValue()
NumberDistance
getValue
in class NumberDistance<IntegerDistance,Integer>
void setValue(Integer value)
NumberDistance
setValue
in class NumberDistance<IntegerDistance,Integer>
value
- the value to be setpublic double doubleValue()
NumberDistance
doubleValue
in class NumberDistance<IntegerDistance,Integer>
public long longValue()
NumberDistance
longValue
in class NumberDistance<IntegerDistance,Integer>
public int intValue()
NumberDistance
intValue
in class NumberDistance<IntegerDistance,Integer>
public int compareTo(IntegerDistance other)
NumberDistance
d1.compareTo(d2)
is the same as
Double.compare(d1.value.doubleValue(),
d2.value.doubleValue())
. Subclasses may need to overwrite this method if
necessary.compareTo
in interface Comparable<IntegerDistance>
compareTo
in class NumberDistance<IntegerDistance,Integer>
other
- Other objectpublic IntegerDistance nullDistance()
Distance
public IntegerDistance undefinedDistance()
Distance
public IntegerDistance infiniteDistance()
Distance
public boolean isInfiniteDistance()
Distance
isInfiniteDistance
in interface Distance<IntegerDistance>
isInfiniteDistance
in class AbstractDistance<IntegerDistance>
public boolean isNullDistance()
Distance
isNullDistance
in interface Distance<IntegerDistance>
isNullDistance
in class AbstractDistance<IntegerDistance>
public boolean isUndefinedDistance()
Distance
isUndefinedDistance
in interface Distance<IntegerDistance>
isUndefinedDistance
in class AbstractDistance<IntegerDistance>
public IntegerDistance parseString(String val) throws IllegalArgumentException
Distance
val
- a pattern defining a similarity suitable to this measurement
functionIllegalArgumentException
- if the given pattern is not compatible
with the requirements of this measurement functionpublic Pattern getPattern()
AbstractDistance
getPattern
in class AbstractDistance<IntegerDistance>