com.vividsolutions.jcs.conflate.polygonmatch
Class Histogram

java.lang.Object
  extended bycom.vividsolutions.jcs.conflate.polygonmatch.Histogram

public class Histogram
extends java.lang.Object

Generic model for a bar graph.


Constructor Summary
Histogram(int binCount)
          Creates a Histogram with the given number of bins.
 
Method Summary
 void add(Histogram other)
          Adds another Histogram's bin scores to this Histogram's bin scores.
 void addToBinScore(int i, double score)
          Adds a score to the ith bin.
 int getBinCount()
          Returns the number of bins.
 double getBinScore(int i)
          Returns the score for the ith bin.
 double getTotalScore()
          Adds the scores from all the bins.
 double symDiff(Histogram other)
          Returns the symmetric difference between this Histogram and another Histogram.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Histogram

public Histogram(int binCount)
Creates a Histogram with the given number of bins.

Parameters:
binCount - the number of bins
Method Detail

addToBinScore

public void addToBinScore(int i,
                          double score)
Adds a score to the ith bin.

Parameters:
i - 0, 1, 2, ...
score - the amount by which the ith bin will be incremented

getBinScore

public double getBinScore(int i)
Returns the score for the ith bin.

Parameters:
i - 0, 1, 2, ...
Returns:
the score for the ith bin

getTotalScore

public double getTotalScore()
Adds the scores from all the bins.

Returns:
the sum of the scores in each bin. If the sum is 1, this histogram is said to be "normalized".

getBinCount

public int getBinCount()
Returns the number of bins.

Returns:
the number of bins that make up this Histogram

symDiff

public double symDiff(Histogram other)
Returns the symmetric difference between this Histogram and another Histogram.

Parameters:
other - the Histogram with which the symmetric difference will be computed
Returns:
the sum of the symmetric differences between corresponding bins. The symmetric difference between two corresponding bins is simply the absolute value of the difference.

add

public void add(Histogram other)
Adds another Histogram's bin scores to this Histogram's bin scores. The number of bins must be the same in both Histograms.

Parameters:
other - the Histogram whose scores will be added to this Histogram