Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.distance
Class CorrelationDistance<D extends CorrelationDistance<D>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.distance.AbstractDistance<D>
          extended by de.lmu.ifi.dbs.elki.distance.CorrelationDistance<D>
All Implemented Interfaces:
Distance<D>, Loggable, Externalizable, Serializable, Comparable<D>
Direct Known Subclasses:
PreferenceVectorBasedCorrelationDistance

public class CorrelationDistance<D extends CorrelationDistance<D>>
extends AbstractDistance<D>

The CorrelationDistance is a special Distance that indicates the dissimilarity between correlation connected objects. The CorrelationDistance beween two points is a pair consisting of the correlation dimension of two points and the euclidean distance between the two points.

Author:
Elke Achtert
See Also:
Serialized Form

Field Summary
private  int correlationValue
          The correlation dimension.
private  double euklideanValue
          The euclidean distance.
private static long serialVersionUID
          Generated SerialVersionUID.
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug
 
Constructor Summary
CorrelationDistance()
          Empty constructor for serialization purposes.
CorrelationDistance(int correlationValue, double euklideanValue)
          Constructs a new CorrelationDistance object.
 
Method Summary
 int compareTo(D other)
           
 String description()
          Returns a String as description of this Distance.
 int externalizableSize()
          Retuns the number of Bytes this distance uses if it is written to an external file.
 int getCorrelationValue()
          Returns the correlation dimension between the objects.
 double getEuklideanValue()
          Returns the euclidean distance between the objects.
 int hashCode()
          Any extending class should implement a proper hashCode method.
 D minus(D distance)
          Returns a new Distance by subtracting the given distance from this distance.
 D plus(D distance)
          Returns a new distance as sum of this distance and the given distance.
 void readExternal(ObjectInput in)
          The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
 String toString()
          Returns a string representation of the object.
 void writeExternal(ObjectOutput out)
          The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.AbstractDistance
equals
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, message, progress, progress, progress, verbose, verbose, warning
 
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

correlationValue

private int correlationValue
The correlation dimension.


euklideanValue

private double euklideanValue
The euclidean distance.

Constructor Detail

CorrelationDistance

public CorrelationDistance()
Empty constructor for serialization purposes.


CorrelationDistance

public CorrelationDistance(int correlationValue,
                           double euklideanValue)
Constructs a new CorrelationDistance object.

Parameters:
correlationValue - the correlation dimension to be represented by the CorrelationDistance
euklideanValue - the euclidean distance to be represented by the CorrelationDistance
Method Detail

hashCode

public int hashCode()
Description copied from class: AbstractDistance
Any extending class should implement a proper hashCode method.

Specified by:
hashCode in class AbstractDistance<D extends CorrelationDistance<D>>
See Also:
Object.hashCode()

plus

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

Parameters:
distance - the distancce to be added to this distance
Returns:
a new distance as sum of this distance and the given distance
See Also:
Distance.plus(Distance)

minus

public D minus(D 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
See Also:
Distance.minus(Distance)

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
See Also:
Distance.description()

compareTo

public int compareTo(D other)
See Also:
Comparable.compareTo(Object)

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Parameters:
out - the stream to write the object to
Throws:
IOException - Includes any I/O exceptions that may occur

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Parameters:
in - the stream to read data from in order to restore the object
Throws:
IOException - if I/O errors occur
ClassNotFoundException - If the class for an object being restored cannot be found.

externalizableSize

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

Returns:
12 (4 Byte for an integer, 8 Byte for a double value)

toString

public String toString()
Returns a string representation of the object.

Specified by:
toString in interface Distance<D extends CorrelationDistance<D>>
Overrides:
toString in class Object
Returns:
a string representation of the object.

getCorrelationValue

public int getCorrelationValue()
Returns the correlation dimension between the objects.

Returns:
the correlation dimension

getEuklideanValue

public double getEuklideanValue()
Returns the euclidean distance between the objects.

Returns:
the euclidean distance

Release 0.1 (2008-07-10_1838)