Java Reference
In-Depth Information
/**
* The constructor creates an array of a given
* number of bins. The range of the histogram is given
*bythe upper and lower limit values.
**/
public Histogram (int numBins, double lo, double hi) {
// Check for bad range values.
// Could throw an exception but will just
// use default values;
if (hi < lo) {
lo = 0.0;
hi = 1.0;
}
if (numBins <= 0) numBins = 1;
fNumBins = numBins;
fBins = new int[fNumBins];
fLo = lo;
fHi = hi;
fRange = fHi — fLo;
} // ctor
/**
* This constructor includes the title and horizontal
* axis label.
**/
public Histogram (String title, String xLabel,
int fNumBins, double lo, double hi) {
this (fNumBins, lo, hi);
// Invoke overloaded constructor
fTitle = title;
fXLabel = xLabel;
}
/** Get the title string. **/
public String getTitle ()
{ return fTitle; }
/** Set the title. **/
public void setTitle (String title)
{ fTitle = title; }
/** Get the horizontal axis label. **/
public String getXLabel ()
 
Search WWH ::




Custom Search