sbrt.kernel.math.geom.comp
Class Hamming

java.lang.Object
  extended by sbrt.kernel.math.geom.comp.Hamming

public final class Hamming
extends java.lang.Object

This class is used to compute Hamming distances - the number of differences between two "strings" of equal length.

Author:
This class was written and documented by Jeremiah Wright while in the Wagner lab.

Constructor Summary
Hamming()
           
 
Method Summary
 int getDist(java.util.Collection<?> x, java.util.Collection<?> y)
          Computes and returns the Hamming distance between the provided collections.
 int getDist(java.util.Map<?,?> x, java.util.Map<?,?> y)
          Computes and returns the Hamming distance between the provided maps.
 int getDist(java.lang.Object[] x, java.lang.Object[] y)
          Computes and returns the Hamming distance between the provided arrays.
 int getDist(java.lang.String x, java.lang.String y)
          Computes and returns the Hamming distance between the provided strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Hamming

public Hamming()
Method Detail

getDist

public int getDist(java.lang.String x,
                   java.lang.String y)
Computes and returns the Hamming distance between the provided strings.

Parameters:
x - a string.
y - another string.
Returns:
the Hamming distance between the provided strings.
Throws:
java.lang.IllegalArgumentException - if the lengths of the provided strings are not equal.

getDist

public int getDist(java.lang.Object[] x,
                   java.lang.Object[] y)
Computes and returns the Hamming distance between the provided arrays. Objects are compared via their equals() method.

Parameters:
x - an array of objects.
y - another array of objects.
Returns:
the Hamming distance between the provided arrays.
Throws:
java.lang.IllegalArgumentException - if the lengths of the provided arrays are not equal.

getDist

public int getDist(java.util.Collection<?> x,
                   java.util.Collection<?> y)
Computes and returns the Hamming distance between the provided collections. Objects are compared via their equals() method upon iteration over each collection.

Parameters:
x - a collection of objects.
y - another collection of objects.
Returns:
the Hamming distance between the provided collections.
Throws:
java.lang.IllegalArgumentException - if the lengths of the provided collections are not equal.

getDist

public int getDist(java.util.Map<?,?> x,
                   java.util.Map<?,?> y)
Computes and returns the Hamming distance between the provided maps. The sets of keys from each map must be equal. Map values are compared via their equals() method.

Parameters:
x - a map.
y - another map.
Returns:
the Hamming distance between the provided maps.
Throws:
java.lang.IllegalArgumentException - if the lengths of the provided maps or the key sets are not equal.