Java Reference
In-Depth Information
/** A simple histogram class to count the frequency of
* values of a parameter of interest. **/
class
BetterHist
extends BasicHist
{
/** This constructor initializes the basic elements of
* the histogram.
**/
public BetterHist (int numBins, double lo, double hi)
{
super (numBins, lo, hi);
}
/** Get the low end of the range. **/
public double getLo ()
{
return lo;
}
/** Get the high end of the range. **/
public double getHi ()
{
return hi;
}
/** Get the number of entries in the largest bin. **/
public int getMax ()
{
int max
=
0;
for (int i
=
0; i
<
numBins; i++)
if (max
<
bins[i]) max
=
bins[i];
return max;
}
/** Get the number of entries in the smallest bin. **/
public int getMin ()
{
int min
=
getMax ();
for (int i
=
0; i
<
numBins; i++)
if (min
>
bins[i]) min
=
bins[i];
return min;
}
/** Get the total number of entries **/
public int getTotal ()
{
int total
=
0;
for (int i
=
0; i
<
numBins; i++)
total +
=
bins[i];
return total;
}
/** Get the average and std. dev. of the distribution. **/
public double [] getStats ()
{
int total
=
0;
Search WWH ::
Custom Search