Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

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

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<PreferenceVectorBasedCorrelationDistance>
              extended by de.lmu.ifi.dbs.elki.distance.PreferenceVectorBasedCorrelationDistance
All Implemented Interfaces:
Distance<PreferenceVectorBasedCorrelationDistance>, Loggable, Externalizable, Serializable, Comparable<PreferenceVectorBasedCorrelationDistance>

public class PreferenceVectorBasedCorrelationDistance
extends CorrelationDistance<PreferenceVectorBasedCorrelationDistance>

A PreferenceVectorBasedCorrelationDistance holds additionally to the CorrelationDistance the common preference vector of the two objects defining the distance.

Author:
Elke Achtert
See Also:
Serialized Form

Field Summary
private  BitSet commonPreferenceVector
          The common preference vector of the two objects defining this distance.
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug
 
Constructor Summary
PreferenceVectorBasedCorrelationDistance()
          Empty constructor for serialization purposes.
PreferenceVectorBasedCorrelationDistance(int correlationValue, double euklideanValue, BitSet commonPreferenceVector)
          Constructs a new CorrelationDistance object.
 
Method Summary
 int compareTo(PreferenceVectorBasedCorrelationDistance o)
           
 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.
 BitSet getCommonPreferenceVector()
          Returns the common preference vector of the two objects defining this distance.
 PreferenceVectorBasedCorrelationDistance minus(PreferenceVectorBasedCorrelationDistance distance)
          Returns a new Distance by subtracting the given distance from this distance.
 PreferenceVectorBasedCorrelationDistance plus(PreferenceVectorBasedCorrelationDistance 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.CorrelationDistance
getCorrelationValue, getEuklideanValue, hashCode
 
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

commonPreferenceVector

private BitSet commonPreferenceVector
The common preference vector of the two objects defining this distance.

Constructor Detail

PreferenceVectorBasedCorrelationDistance

public PreferenceVectorBasedCorrelationDistance()
Empty constructor for serialization purposes.


PreferenceVectorBasedCorrelationDistance

public PreferenceVectorBasedCorrelationDistance(int correlationValue,
                                                double euklideanValue,
                                                BitSet commonPreferenceVector)
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
commonPreferenceVector - the common preference vector of the two objects defining this distance
Method Detail

getCommonPreferenceVector

public BitSet getCommonPreferenceVector()
Returns the common preference vector of the two objects defining this distance.

Returns:
the common preference vector

description

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

Specified by:
description in interface Distance<PreferenceVectorBasedCorrelationDistance>
Overrides:
description in class CorrelationDistance<PreferenceVectorBasedCorrelationDistance>
Returns:
a String as description of this Distance
See Also:
Distance.description()

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.

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class CorrelationDistance<PreferenceVectorBasedCorrelationDistance>
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.

Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class CorrelationDistance<PreferenceVectorBasedCorrelationDistance>
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.

Specified by:
externalizableSize in interface Distance<PreferenceVectorBasedCorrelationDistance>
Overrides:
externalizableSize in class CorrelationDistance<PreferenceVectorBasedCorrelationDistance>
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<PreferenceVectorBasedCorrelationDistance>
Overrides:
toString in class CorrelationDistance<PreferenceVectorBasedCorrelationDistance>
Returns:
a string representation of the object.

plus

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

Specified by:
plus in interface Distance<PreferenceVectorBasedCorrelationDistance>
Overrides:
plus in class CorrelationDistance<PreferenceVectorBasedCorrelationDistance>
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 PreferenceVectorBasedCorrelationDistance minus(PreferenceVectorBasedCorrelationDistance distance)
Description copied from interface: Distance
Returns a new Distance by subtracting the given distance from this distance.

Specified by:
minus in interface Distance<PreferenceVectorBasedCorrelationDistance>
Overrides:
minus in class CorrelationDistance<PreferenceVectorBasedCorrelationDistance>
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)

compareTo

public int compareTo(PreferenceVectorBasedCorrelationDistance o)
Specified by:
compareTo in interface Comparable<PreferenceVectorBasedCorrelationDistance>
Overrides:
compareTo in class CorrelationDistance<PreferenceVectorBasedCorrelationDistance>
Throws:
UnsupportedOperationException
See Also:
Comparable.compareTo(Object)

Release 0.1 (2008-07-10_1838)