
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, toStringequals, requiredInputPattern, testInputPatternpublic static final IntegerDistance FACTORY
int value
private static final long serialVersionUID
public IntegerDistance()
public IntegerDistance(int value)
value - distance valuepublic IntegerDistance fromDouble(double val)
NumberDistancefromDouble in class NumberDistance<IntegerDistance,Integer>val - Valuepublic IntegerDistance minus(IntegerDistance distance)
Distancedistance - the distance to be subtracted from this distancepublic IntegerDistance plus(IntegerDistance distance)
Distancedistance - the distance to be added to this distancepublic void writeExternal(ObjectOutput out) throws IOException
IOExceptionpublic void readExternal(ObjectInput in) throws IOException
IOExceptionpublic int externalizableSize()
public Integer getValue()
NumberDistancegetValue in class NumberDistance<IntegerDistance,Integer>void setValue(Integer value)
NumberDistancesetValue in class NumberDistance<IntegerDistance,Integer>value - the value to be setpublic double doubleValue()
NumberDistancedoubleValue in class NumberDistance<IntegerDistance,Integer>public long longValue()
NumberDistancelongValue in class NumberDistance<IntegerDistance,Integer>public int intValue()
NumberDistanceintValue in class NumberDistance<IntegerDistance,Integer>public int compareTo(IntegerDistance other)
NumberDistanced1.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()
Distancepublic IntegerDistance undefinedDistance()
Distancepublic IntegerDistance infiniteDistance()
Distancepublic boolean isInfiniteDistance()
DistanceisInfiniteDistance in interface Distance<IntegerDistance>isInfiniteDistance in class AbstractDistance<IntegerDistance>public boolean isNullDistance()
DistanceisNullDistance in interface Distance<IntegerDistance>isNullDistance in class AbstractDistance<IntegerDistance>public boolean isUndefinedDistance()
DistanceisUndefinedDistance in interface Distance<IntegerDistance>isUndefinedDistance in class AbstractDistance<IntegerDistance>public IntegerDistance parseString(String val) throws IllegalArgumentException
Distanceval - 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()
AbstractDistancegetPattern in class AbstractDistance<IntegerDistance>