
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) |
double |
doubleValue()
Get the value as double.
|
boolean |
equals(Object obj)
Returns true if
this == o has the value true or o
is not null and o is of the same class as this instance and
this.compareTo(o) is 0, false otherwise. |
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
|
int |
hashCode()
Any extending class should implement a proper hashCode method.
|
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.
|
String |
toString()
Any implementing class should implement a proper toString-method for
printing the result-values.
|
IntegerDistance |
undefinedDistance()
Provides an undefined distance.
|
void |
writeExternal(ObjectOutput out)
Writes the integer value of this IntegerDistance to the specified stream.
|
byteValue, floatValue, shortValuerequiredInputPattern, 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 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)
public 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 String toString()
DistancetoString in interface Distance<IntegerDistance>toString in class Objectpublic int hashCode()
AbstractDistancehashCode in class AbstractDistance<IntegerDistance>public boolean equals(Object obj)
AbstractDistancethis == o has the value true or o
is not null and o is of the same class as this instance and
this.compareTo(o) is 0, false otherwise.equals in class AbstractDistance<IntegerDistance>public Pattern getPattern()
AbstractDistancegetPattern in class AbstractDistance<IntegerDistance>