jetweb is hosted by Hepforge, IPPP Durham

cedar.jetweb.hist
Class PlotDataSource

java.lang.Object
  extended by cedar.jetweb.hist.PlotDataSource
All Implemented Interfaces:
jas.hist.DataSource, jas.hist.HasStyle, jas.hist.Rebinnable1DHistogramData

public class PlotDataSource
extends java.lang.Object
implements jas.hist.Rebinnable1DHistogramData, jas.hist.HasStyle

The JetWeb 1D Histogram object. The jetweb implementation of the interface Rebinnable1DHistogramData.

Version:
$date$ $revision$
Author:
Jon Butterworth
See Also:
Rebinnable1DHistogramData, Rebinnable2DHistogramData

Field Summary
 
Fields inherited from interface jas.hist.DataSource
DATE, DELTATIME, DOUBLE, INTEGER, STRING
 
Constructor Summary
PlotDataSource(DataPlot plot, double scalef)
          Constructs plotDataSource from a dataplot.
 
Method Summary
 java.lang.String[] getAxisLabels()
          Returns the axis labels.
 int getAxisType()
          Returns one of DOUBLE,INTEGER,STRING,DATE or DELTATIME
 int getBins()
          Returns the (suggested) number of bins to use
 double getMax()
          Returns the (suggested) maximum value for the X axis
 double getMin()
          Returns the (suggested) minimum value for the X axis
 jas.hist.JASHistStyle getStyle()
          get the style attributes for this histogram
 java.lang.String getTitle()
          NOT IMPLEMENTED
 boolean isReal()
           
 boolean isRebinnable()
          Returns true if the data source is capable of recalculating the bin contents, or false of the interface is not-capable of recalculating the bin contents.
 double[][] rebin(int bins, double min, double max, boolean wantErrors, boolean hurry)
          Called to request the binned data be returned.
protected  void setBins(int i)
          allows VariableDataSources to set nbins in each source
protected  void setMax(double d)
          allows VariableDataSources to set xmax in each source
protected  void setMin(double d)
          allows VariableDataSources to set xmin in each source
 void setStyleDefault()
          set style attributes for this histogram as default
protected  void setTheData(double[][] td)
          allows VariableDataSources to set data in each source
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlotDataSource

public PlotDataSource(DataPlot plot,
                      double scalef)
               throws JetWebException
Constructs plotDataSource from a dataplot. Each plot contains a Vector of DataPoint objects.

Throws:
JetWebException
See Also:
DataPoint

Method Detail

isReal

public boolean isReal()

rebin

public double[][] rebin(int bins,
                        double min,
                        double max,
                        boolean wantErrors,
                        boolean hurry)
Called to request the binned data be returned. If the DataSource indicated it was not rebinnable then the bins, min and max arguments are guaranteed to be the same values as returned by getMin(), getMax() and getBins() methods.

The routine returns a two dimensional array where the first dimension has the following meaning:

If the minus error is absent the errors are assumed to be symmetric, if the plus error is also absent the errors are assumed to be the square root of the data.

Specified by:
rebin in interface jas.hist.Rebinnable1DHistogramData
Parameters:
bin - The number of bins requested
min - The min of the range over which to bin
max - The max of the range over which to bin
wantErrors - If false indicates that the errors are not required and need not be calculated (most implementations will ignore this parameter)
hurry - If true indicates the results should be provided as fast as possible, even if some approximation is needed (most implementations will ignore this parameter)
Returns:
An array representing the binned data and errors (see description above)


getMin

public double getMin()
Returns the (suggested) minimum value for the X axis

Specified by:
getMin in interface jas.hist.Rebinnable1DHistogramData
Returns:
xmin


getMax

public double getMax()
Returns the (suggested) maximum value for the X axis

Specified by:
getMax in interface jas.hist.Rebinnable1DHistogramData
Returns:
xmax


getBins

public int getBins()
Returns the (suggested) number of bins to use

Specified by:
getBins in interface jas.hist.Rebinnable1DHistogramData
Returns:
nbins


isRebinnable

public boolean isRebinnable()
Returns true if the data source is capable of recalculating the bin contents, or false of the interface is not-capable of recalculating the bin contents. In the former case the values returned by getMin, getMax and getBins are just taken to be suggestions, in the latter case they are taken to be fixed in stone.

Specified by:
isRebinnable in interface jas.hist.Rebinnable1DHistogramData
Returns:
True if the datasource is rebinnable


getAxisType

public int getAxisType()
Returns one of DOUBLE,INTEGER,STRING,DATE or DELTATIME

Specified by:
getAxisType in interface jas.hist.Rebinnable1DHistogramData
Returns:
axis type


getTitle

public java.lang.String getTitle()
NOT IMPLEMENTED

Specified by:
getTitle in interface jas.hist.DataSource
Returns:
empty string


getAxisLabels

public java.lang.String[] getAxisLabels()
Returns the axis labels. Only relevant if the axisType is STRING, otherwise can return null

Specified by:
getAxisLabels in interface jas.hist.Rebinnable1DHistogramData
Returns:
An array of bin labels to use on the X axis


setTheData

protected void setTheData(double[][] td)
allows VariableDataSources to set data in each source

Parameters:
td - data array


setBins

protected void setBins(int i)
allows VariableDataSources to set nbins in each source

Parameters:
i - - number of bins


setMin

protected void setMin(double d)
allows VariableDataSources to set xmin in each source

Parameters:
d - - xmin


setMax

protected void setMax(double d)
allows VariableDataSources to set xmax in each source

Parameters:
d - - xmax


getStyle

public jas.hist.JASHistStyle getStyle()
get the style attributes for this histogram

Specified by:
getStyle in interface jas.hist.HasStyle
Returns:
style attributes object


setStyleDefault

public void setStyleDefault()
set style attributes for this histogram as default