Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

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

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

public class FloatDistance
extends NumberDistance<FloatDistance,Float>

Provides a Distance for a float-valued distance.

Author:
Elke Achtert
See Also:
Serialized Form

Field Summary
private static long serialVersionUID
          Generated serialVersionUID.
 
Constructor Summary
FloatDistance()
          Empty constructor for serialization purposes.
FloatDistance(float value)
          Constructs a new FloatDistance object that represents the float 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.
 FloatDistance minus(FloatDistance distance)
          Returns a new Distance by subtracting the given distance from this distance.
 FloatDistance plus(FloatDistance distance)
          Returns a new distance as sum of this distance and the given distance.
 void readExternal(ObjectInput in)
          Reads the float value of this FloatDistance from the specified stream.
 FloatDistance times(float lambda)
          Returns a new distance as the product of this distance and the given float value.
 FloatDistance times(FloatDistance distance)
          Returns a new distance as the product of this distance and the given distance.
 void writeExternal(ObjectOutput out)
          Writes the float value of this FloatDistance 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

FloatDistance

public FloatDistance()
Empty constructor for serialization purposes.


FloatDistance

public FloatDistance(float value)
Constructs a new FloatDistance object that represents the float argument.

Parameters:
value - the value to be represented by the FloatDistance.
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 FloatDistance plus(FloatDistance 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 FloatDistance minus(FloatDistance 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 FloatDistance times(FloatDistance 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 FloatDistance times(float lambda)
Returns a new distance as the product of this distance and the given float value.

Parameters:
lambda - the float 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 float value of this FloatDistance to the specified stream.

Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException
Reads the float value of this FloatDistance 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:
4 (4 Byte for a float value)

Release 0.2.1 (2009-07-13_1605)