de.lmu.ifi.dbs.elki.distance.distancevalue
Interface Distance<D extends Distance<D>>

Type Parameters:
D - the type of Distance used
All Superinterfaces:
Comparable<D>, Externalizable, Serializable
All Known Implementing Classes:
AbstractDistance, BitDistance, CorrelationDistance, DoubleDistance, FloatDistance, IntegerDistance, NumberDistance, PCACorrelationDistance, PreferenceVectorBasedCorrelationDistance, SubspaceDistance

public interface Distance<D extends Distance<D>>
extends Comparable<D>, Externalizable

The interface Distance defines the requirements of any instance class. See DistanceUtil for related utility functions such as min, max.

See Also:
DistanceUtil

Method Summary
 int externalizableSize()
          Returns the number of Bytes this distance uses if it is written to an external file.
 D infiniteDistance()
          Provides an infinite distance.
 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.
 D minus(D distance)
          Returns a new Distance by subtracting the given distance from this distance.
 D nullDistance()
          Provides a null distance.
 D parseString(String pattern)
          Provides a measurement suitable to this measurement function based on the given pattern.
 D plus(D distance)
          Returns a new distance as sum of this distance and the given distance.
 String requiredInputPattern()
          Returns a String as description of the required input format.
 String toString()
          Any implementing class should implement a proper toString-method for printing the result-values.
 D undefinedDistance()
          Provides an undefined distance.
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 

Method Detail

plus

D plus(D 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

D minus(D 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

toString

String toString()
Any implementing class should implement a proper toString-method for printing the result-values.

Overrides:
toString in class Object
Returns:
String a human-readable representation of the Distance

parseString

D parseString(String pattern)
                                  throws IllegalArgumentException
Provides a measurement suitable to this measurement function based on the given pattern.

Parameters:
pattern - a pattern defining a similarity suitable to this measurement function
Returns:
a measurement suitable to this measurement function based on the given pattern
Throws:
IllegalArgumentException - if the given pattern is not compatible with the requirements of this measurement function

requiredInputPattern

String requiredInputPattern()
Returns a String as description of the required input format.

Returns:
a String as description of the required input format

externalizableSize

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

Returns:
the number of Bytes this distance uses if it is written to an external file

infiniteDistance

D infiniteDistance()
Provides an infinite distance.

Returns:
an infinite distance

nullDistance

D nullDistance()
Provides a null distance.

Returns:
a null distance

undefinedDistance

D undefinedDistance()
Provides an undefined distance.

Returns:
an undefined distance

isInfiniteDistance

boolean isInfiniteDistance()
Returns true, if the distance is an infinite distance, false otherwise.

Returns:
true, if the distance is an infinite distance, false otherwise

isNullDistance

boolean isNullDistance()
Returns true, if the distance is a null distance, false otherwise.

Returns:
true, if the distance is a null distance, false otherwise

isUndefinedDistance

boolean isUndefinedDistance()
Returns true, if the distance is an undefined distance, false otherwise.

Returns:
true, if the distance is an undefined distance, false otherwise

Release 0.4.0 (2011-09-20_1324)