jas.hist.util
Class OneDAdapter

java.lang.Object
  |
  +--java.util.Observable
        |
        +--jas.hist.util.ObserverAdapter
              |
              +--jas.hist.util.OneDAdapter
All Implemented Interfaces:
DataSource, HasStatistics, HasStyle, java.util.Observer, Rebinnable1DHistogramData
Direct Known Subclasses:
OneDTreeData

public class OneDAdapter
extends ObserverAdapter
implements Rebinnable1DHistogramData, HasStatistics, HasStyle

A class which simply acts as a proxy for the DataSource provided as an argument to its constructor. Not very useful in itself, but can be used as a base class for more interesting adapters.


Field Summary
protected  Rebinnable1DHistogramData source
           
 
Fields inherited from interface jas.hist.DataSource
DATE, DELTATIME, DOUBLE, INTEGER, STRING
 
Constructor Summary
OneDAdapter(Rebinnable1DHistogramData source)
           
 
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
 Statistics getStatistics()
           
 JASHistStyle getStyle()
          This method is called by the plot to determine what style to be used for a plot.
 java.lang.String getTitle()
          Return the caption to be used in the legend for this data.
 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.
 java.lang.String toString()
           
 
Methods inherited from class jas.hist.util.ObserverAdapter
addObserver, clearObservable, deleteObserver, deleteObservers, setObservable, update
 
Methods inherited from class java.util.Observable
clearChanged, countObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

source

protected Rebinnable1DHistogramData source
Constructor Detail

OneDAdapter

public OneDAdapter(Rebinnable1DHistogramData source)
Method Detail

rebin

public double[][] rebin(int bins,
                        double min,
                        double max,
                        boolean wantErrors,
                        boolean hurry)
Description copied from interface: Rebinnable1DHistogramData
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 Rebinnable1DHistogramData
Following copied from 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()
Description copied from interface: Rebinnable1DHistogramData
Returns the (suggested) minimum value for the X axis
Specified by:
getMin in interface Rebinnable1DHistogramData

getMax

public double getMax()
Description copied from interface: Rebinnable1DHistogramData
Returns the (suggested) maximum value for the X axis
Specified by:
getMax in interface Rebinnable1DHistogramData

getBins

public int getBins()
Description copied from interface: Rebinnable1DHistogramData
Returns the (suggested) number of bins to use
Specified by:
getBins in interface Rebinnable1DHistogramData

isRebinnable

public boolean isRebinnable()
Description copied from interface: Rebinnable1DHistogramData
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 Rebinnable1DHistogramData
Following copied from interface: jas.hist.Rebinnable1DHistogramData
Returns:
True if the datasource is rebinnable

getAxisType

public int getAxisType()
Description copied from interface: Rebinnable1DHistogramData
Returns one of DOUBLE,INTEGER,STRING,DATE or DELTATIME
Specified by:
getAxisType in interface Rebinnable1DHistogramData

getAxisLabels

public java.lang.String[] getAxisLabels()
Description copied from interface: Rebinnable1DHistogramData
Returns the axis labels. Only relevant if the axisType is STRING, otherwise can return null
Specified by:
getAxisLabels in interface Rebinnable1DHistogramData
Following copied from interface: jas.hist.Rebinnable1DHistogramData
Returns:
An array of bin labels to use on the X axis

getTitle

public java.lang.String getTitle()
Description copied from interface: DataSource
Return the caption to be used in the legend for this data.
Specified by:
getTitle in interface DataSource

getStatistics

public Statistics getStatistics()
Specified by:
getStatistics in interface HasStatistics

getStyle

public JASHistStyle getStyle()
Description copied from interface: HasStyle
This method is called by the plot to determine what style to be used for a plot. It is the programmers responsibility to return the correct subclass of JASHistStyle corresponding to the type of data being implemented by the DataSource.
Specified by:
getStyle in interface HasStyle
Following copied from interface: jas.hist.HasStyle
Returns:
The style to be used, or null to use the default style.
See Also:
JASHist1DHistogramStyle, JASHist2DHistogramStyle, JASHistScatterPlotStyle

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object