Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

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

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

public class BitDistance
extends NumberDistance<BitDistance,Bit>

Provides a Distance for a bit-valued distance.

Author:
Arthur Zimek
See Also:
Serialized Form

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

See Also:
Constant Field Values
Constructor Detail

BitDistance

public BitDistance()
Empty constructor for serialization purposes.


BitDistance

public BitDistance(boolean bit)
Constructs a new BitDistance object that represents the bit argument.

Parameters:
bit - the value to be represented by the BitDistance.
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 BitDistance plus(BitDistance 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 BitDistance minus(BitDistance 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

bitValue

public boolean bitValue()
Returns the value of this BitDistance as a boolean.

Returns:
the value as a boolean

writeExternal

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

Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException
Reads the bit value of this BitDistance 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:
1 (1 Byte for a boolean value)

Release 0.2.1 (2009-07-13_1605)