net.aerith.misao.util
Class Histogram

java.lang.Object
  |
  +--net.aerith.misao.util.Histogram

public class Histogram
extends java.lang.Object
implements Statisticable

The Histogram represents a histogram of the specified statisticable buffer.


Field Summary
protected  int[] buffer
          The buffer.
 
Constructor Summary
protected Histogram()
          Constructs an empty Histogram.
  Histogram(Statisticable target_buffer, double minimum_value, double maximum_value, int division_count)
          Constructs a Histogram of the specified statisticable buffer.
 
Method Summary
 Histogram accumulate()
          Accumulates the amount values in this histogram and creates a new Histogram.
 Array createCloneArray()
          Creates a clone Array.
 int getAt(int index)
          Gets the amount of pixels at the block of the specified index.
 int getDataCount()
          Gets the number of data.
 int getOverflow()
          Gets the amount of pixels whose value is greater than the specified maximum value.
 int getUnderflow()
          Gets the amount of pixels whose value is smaller than the specified minimum value.
 double getValueAt(int index)
          Gets the value of data at the specified location.
 double lookup(double index)
          Looks up this histogram and gets the amount value of the specified index.
 double lookupInversed(double value)
          Looks up the inversed histogram and gets the index of the specified amount value.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

buffer

protected int[] buffer
The buffer.
Constructor Detail

Histogram

protected Histogram()
Constructs an empty Histogram.

Histogram

public Histogram(Statisticable target_buffer,
                 double minimum_value,
                 double maximum_value,
                 int division_count)
Constructs a Histogram of the specified statisticable buffer.
Parameters:
target_buffer - the statisticable buffer to calculate histogram.
minimum_value - the minimum value of the histogram range.
maximum_value - the maximum value of the histogram range.
division_count - the division_count;
Method Detail

getDataCount

public int getDataCount()
Gets the number of data.
Specified by:
getDataCount in interface Statisticable
Returns:
the number of data.

getValueAt

public double getValueAt(int index)
                  throws java.lang.IndexOutOfBoundsException
Gets the value of data at the specified location.
Specified by:
getValueAt in interface Statisticable
Parameters:
index - the location of the data.
Returns:
the value of data at the specified location.
Throws:
java.lang.IndexOutOfBoundsException - if specified location is out of the data buffer.

getUnderflow

public int getUnderflow()
Gets the amount of pixels whose value is smaller than the specified minimum value.
Returns:
the amount.

getOverflow

public int getOverflow()
Gets the amount of pixels whose value is greater than the specified maximum value.
Returns:
the amount.

getAt

public int getAt(int index)
Gets the amount of pixels at the block of the specified index.
Parameters:
index - the index.
Returns:
the amount.

lookup

public double lookup(double index)
Looks up this histogram and gets the amount value of the specified index.
Parameters:
the - index of buffer to look up.
Returns:
the amount value.

lookupInversed

public double lookupInversed(double value)
Looks up the inversed histogram and gets the index of the specified amount value.
Parameters:
value - the amount value to look up.
Returns:
the index of buffer which contains the specified amount value.

accumulate

public Histogram accumulate()
Accumulates the amount values in this histogram and creates a new Histogram.
Returns:
the new histogram.

createCloneArray

public Array createCloneArray()
Creates a clone Array.
Returns:
the new array.