public class DoubleDistance extends NumberDistance<DoubleDistance,Double>
Modifier and Type | Field and Description |
---|---|
static DoubleDistance |
FACTORY
The static factory instance
|
static DoubleDistance |
INFINITE_DISTANCE
Infinite distance constant
|
private static long |
serialVersionUID
Generated serialVersionUID.
|
static DoubleDistance |
UNDEFINED_DISTANCE
Undefined distance constant
|
(package private) double |
value
The actual value.
|
static DoubleDistance |
ZERO_DISTANCE
Zero distance constant
|
DOUBLE_PATTERN, INFINITY_PATTERN, INTEGER_PATTERN
Constructor and Description |
---|
DoubleDistance()
Empty constructor for serialization purposes.
|
DoubleDistance(double value)
Constructs a new DoubleDistance object that represents the double argument.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(DoubleDistance 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.
|
DoubleDistance |
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.
|
DoubleDistance |
infiniteDistance()
An infinite DoubleDistance is based on
Double.POSITIVE_INFINITY . |
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.
|
DoubleDistance |
nullDistance()
A null DoubleDistance is based on 0.
|
DoubleDistance |
parseString(String val)
As pattern is required a String defining a Double.
|
void |
readExternal(ObjectInput in)
Reads the double value of this DoubleDistance from the specified stream.
|
String |
toString()
Any implementing class should implement a proper toString-method for
printing the result-values.
|
DoubleDistance |
undefinedDistance()
An undefined DoubleDistance is based on
Double.NaN . |
void |
writeExternal(ObjectOutput out)
Writes the double value of this DoubleDistance to the specified stream.
|
byteValue, floatValue, intValue, shortValue
requiredInputPattern, testInputPattern
public static final DoubleDistance ZERO_DISTANCE
public static final DoubleDistance INFINITE_DISTANCE
public static final DoubleDistance UNDEFINED_DISTANCE
public static final DoubleDistance FACTORY
double value
private static final long serialVersionUID
public DoubleDistance()
public DoubleDistance(double value)
value
- the value to be represented by the DoubleDistance.public DoubleDistance fromDouble(double val)
NumberDistance
fromDouble
in class NumberDistance<DoubleDistance,Double>
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<DoubleDistance,Double>
public long longValue()
NumberDistance
longValue
in class NumberDistance<DoubleDistance,Double>
public int compareTo(DoubleDistance other)
public DoubleDistance infiniteDistance()
Double.POSITIVE_INFINITY
.public DoubleDistance nullDistance()
public DoubleDistance undefinedDistance()
Double.NaN
.public DoubleDistance parseString(String val) throws IllegalArgumentException
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 boolean isInfiniteDistance()
Distance
isInfiniteDistance
in interface Distance<DoubleDistance>
isInfiniteDistance
in class AbstractDistance<DoubleDistance>
public boolean isNullDistance()
Distance
isNullDistance
in interface Distance<DoubleDistance>
isNullDistance
in class AbstractDistance<DoubleDistance>
public boolean isUndefinedDistance()
Distance
isUndefinedDistance
in interface Distance<DoubleDistance>
isUndefinedDistance
in class AbstractDistance<DoubleDistance>
public Pattern getPattern()
AbstractDistance
getPattern
in class AbstractDistance<DoubleDistance>
public String toString()
Distance
toString
in interface Distance<DoubleDistance>
toString
in class Object
public int hashCode()
AbstractDistance
hashCode
in class AbstractDistance<DoubleDistance>
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<DoubleDistance>