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 |
nullDistance()
Provides a null distance.
|
IntegerDistance |
parseString(String val)
Provides a measurement suitable to this measurement function based on the
given pattern.
|
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, shortValue
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 void writeExternal(ObjectOutput out) throws IOException
IOException
public void readExternal(ObjectInput in) throws IOException
IOException
public int externalizableSize()
public 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)
public 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 String toString()
Distance
toString
in interface Distance<IntegerDistance>
toString
in class Object
public int hashCode()
AbstractDistance
hashCode
in class AbstractDistance<IntegerDistance>
public boolean equals(Object obj)
AbstractDistance
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.equals
in class AbstractDistance<IntegerDistance>
public Pattern getPattern()
AbstractDistance
getPattern
in class AbstractDistance<IntegerDistance>