|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.distance.distancevalue.AbstractDistance<D> de.lmu.ifi.dbs.elki.distance.distancevalue.NumberDistance<DoubleDistance,Double> de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance
public class DoubleDistance
Provides a Distance for a double-valued distance.
Field Summary | |
---|---|
static DoubleDistance |
FACTORY
The static factory instance |
private static long |
serialVersionUID
Generated serialVersionUID. |
(package private) double |
value
The actual value. |
Fields inherited from class de.lmu.ifi.dbs.elki.distance.distancevalue.AbstractDistance |
---|
DOUBLE_PATTERN, INFINITY_PATTERN, INTEGER_PATTERN |
Constructor Summary | |
---|---|
DoubleDistance()
Empty constructor for serialization purposes. |
|
DoubleDistance(double value)
Constructs a new DoubleDistance object that represents the double argument. |
Method Summary | |
---|---|
int |
compareTo(DoubleDistance 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. |
DoubleDistance |
fromDouble(double val)
Build a new instance from a double value. |
Pattern |
getPattern()
Get the pattern accepted by this distance |
Double |
getValue()
Returns the value of this NumberDistance. |
int |
hashCode()
Returns the hash code for this NumberDistance, which is the hash code of its value. |
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 |
minus(DoubleDistance distance)
Returns a new Distance by subtracting the given distance from this distance. |
DoubleDistance |
nullDistance()
A null DoubleDistance is based on 0. |
DoubleDistance |
parseString(String val)
As pattern is required a String defining a Double. |
DoubleDistance |
plus(DoubleDistance distance)
Returns a new distance as sum of this distance and the given distance. |
void |
readExternal(ObjectInput in)
Reads the double value of this DoubleDistance from the specified stream. |
(package private) void |
setValue(Double value)
Sets the value of this NumberDistance. |
DoubleDistance |
times(double lambda)
Returns a new distance as the product of this distance and the given double value. |
DoubleDistance |
times(DoubleDistance distance)
Returns a new distance as the product of this distance and the given distance. |
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. |
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancevalue.NumberDistance |
---|
byteValue, floatValue, intValue, shortValue, toString |
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancevalue.AbstractDistance |
---|
equals, requiredInputPattern, testInputPattern |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final DoubleDistance FACTORY
double value
private static final long serialVersionUID
Constructor Detail |
---|
public DoubleDistance()
public DoubleDistance(double value)
value
- the value to be represented by the DoubleDistance.Method Detail |
---|
public DoubleDistance fromDouble(double val)
NumberDistance
fromDouble
in class NumberDistance<DoubleDistance,Double>
val
- Value
public DoubleDistance plus(DoubleDistance distance)
Distance
distance
- the distance to be added to this distance
public DoubleDistance minus(DoubleDistance distance)
Distance
distance
- the distance to be subtracted from this distance
public DoubleDistance times(DoubleDistance distance)
distance
- the distance to be multiplied with this distance
public DoubleDistance times(double lambda)
lambda
- the double value this distance should be multiplied with
public void writeExternal(ObjectOutput out) throws IOException
IOException
public void readExternal(ObjectInput in) throws IOException
IOException
public int externalizableSize()
public Double getValue()
NumberDistance
getValue
in class NumberDistance<DoubleDistance,Double>
void setValue(Double value)
NumberDistance
setValue
in class NumberDistance<DoubleDistance,Double>
value
- the value to be setpublic double doubleValue()
NumberDistance
doubleValue
in class NumberDistance<DoubleDistance,Double>
public long longValue()
NumberDistance
longValue
in class NumberDistance<DoubleDistance,Double>
public int compareTo(DoubleDistance 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<DoubleDistance>
compareTo
in class NumberDistance<DoubleDistance,Double>
other
- Other object
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
function
IllegalArgumentException
- 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 int hashCode()
NumberDistance
hashCode
in class NumberDistance<DoubleDistance,Double>
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |