Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.distance
Class DoubleDistance

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.distance.AbstractDistance<D>
      extended by de.lmu.ifi.dbs.elki.distance.NumberDistance<DoubleDistance,Double>
          extended by de.lmu.ifi.dbs.elki.distance.DoubleDistance
All Implemented Interfaces:
Distance<DoubleDistance>, Externalizable, Serializable, Comparable<DoubleDistance>

public class DoubleDistance
extends NumberDistance<DoubleDistance,Double>

Provides a Distance for a double-valued distance.

Author:
Elke Achtert
See Also:
Serialized Form

Field Summary
private static long serialVersionUID
          Generated serialVersionUID.
 
Constructor Summary
DoubleDistance()
          Empty constructor for serialization purposes.
DoubleDistance(double value)
          Constructs a new DoubleDistance object that represents the double argument.
 
Method Summary
 String description()
          Returns a String as description of this Distance.
 int externalizableSize()
          Returns the number of Bytes this distance uses if it is written to an external file.
 DoubleDistance minus(DoubleDistance distance)
          Returns a new Distance by subtracting the given distance from this distance.
 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.
 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.
 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.NumberDistance
compareTo, getValue, hashCode, setValue, toString
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.AbstractDistance
equals
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Generated serialVersionUID.

See Also:
Constant Field Values
Constructor Detail

DoubleDistance

public DoubleDistance()
Empty constructor for serialization purposes.


DoubleDistance

public DoubleDistance(double value)
Constructs a new DoubleDistance object that represents the double argument.

Parameters:
value - the value to be represented by the DoubleDistance.
Method Detail

description

public String description()
Description copied from interface: Distance
Returns a String as description of this Distance.

Returns:
a String as description of this Distance

plus

public DoubleDistance plus(DoubleDistance distance)
Description copied from interface: Distance
Returns a new distance as sum of this distance and the given distance.

Parameters:
distance - the distance to be added to this distance
Returns:
a new distance as sum of this distance and the given distance

minus

public DoubleDistance minus(DoubleDistance distance)
Description copied from interface: Distance
Returns a new Distance by subtracting the given distance from this distance.

Parameters:
distance - the distance to be subtracted from this distance
Returns:
a new Distance by subtracting the given distance from this distance

times

public DoubleDistance times(DoubleDistance distance)
Returns a new distance as the product of this distance and the given distance.

Parameters:
distance - the distance to be multiplied with this distance
Returns:
a new distance as the product of this distance and the given distance

times

public DoubleDistance times(double lambda)
Returns a new distance as the product of this distance and the given double value.

Parameters:
lambda - the double value this distance should be multiplied with
Returns:
a new distance as the product of this distance and the given double value

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Writes the double value of this DoubleDistance to the specified stream.

Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException
Reads the double value of this DoubleDistance from the specified stream.

Throws:
IOException

externalizableSize

public int externalizableSize()
Returns the number of Bytes this distance uses if it is written to an external file.

Returns:
8 (8 Byte for a double value)

Release 0.2.1 (2009-07-13_1605)