Class Histogram

java.lang.Object
  |
  +--Histogram

class Histogram
extends java.lang.Object
implements Solvable

Implementation of a histogram as a Sovable object.


Field Summary
protected  double[] data
          The raw data to be organized.
protected  int intervals
           
protected  double max
           
protected  double min
           
 
Constructor Summary
Histogram(double min, double max, int intervals)
          Creates a new histogram.
 
Method Summary
 double[] getData()
          Returns the raw data
 int[] getFreqs()
          Produces a frequency table for the collected data, with intervals as specified in the constructor.
 void setData(double[] d)
          Sets the raw data
 void solve(double x0, double step, double[] solns)
          Fills the supplied area with "step function data".
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

data

protected double[] data
The raw data to be organized. This will usually be set via the setData() method.

min

protected double min

max

protected double max

intervals

protected int intervals
Constructor Detail

Histogram

public Histogram(double min,
                 double max,
                 int intervals)
Creates a new histogram.
Parameters:
min - The minimum data value to be included
max - The maximum data value to be included
intervals - The number of intervals into which the range should be divided
Method Detail

solve

public void solve(double x0,
                  double step,
                  double[] solns)
Fills the supplied area with "step function data". If plotted, the data will form either a series of horizontal bars, or (if interpolation is enabled on the Plotter) the outline of a bar graph.
Specified by:
solve in interface Solvable
Tags copied from interface: Solvable
Parameters:
x0 - The initial x-value
step - The increment to be applied to x0
vals - The array which will hold the solution data

getFreqs

public int[] getFreqs()
Produces a frequency table for the collected data, with intervals as specified in the constructor.

getData

public double[] getData()
Returns the raw data

setData

public void setData(double[] d)
Sets the raw data