jas.hist.util
Class TwoDAdapter

java.lang.Object
  |
  +--java.util.Observable
        |
        +--jas.hist.util.ObserverAdapter
              |
              +--jas.hist.util.TwoDAdapter
All Implemented Interfaces:
DataSource, HasSlices, HasStatistics, HasStyle, java.util.Observer, Rebinnable2DHistogramData
Direct Known Subclasses:
ScatterAdapter

public class TwoDAdapter
extends ObserverAdapter
implements Rebinnable2DHistogramData, HasStyle, HasStatistics, HasSlices

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  Rebinnable2DHistogramData source
           
 
Fields inherited from interface jas.hist.DataSource
DATE, DELTATIME, DOUBLE, INTEGER, STRING
 
Constructor Summary
TwoDAdapter(Rebinnable2DHistogramData source)
           
 
Method Summary
 int addSlice(double x, double y, double width, double height, double phi)
          Create a new slice with the specified initial parameters
 boolean canAddRemoveSlices()
           
 int getNSlices()
          Number of slices currently attached to plot
 Rebinnable1DHistogramData getSlice(int n)
          Get the data corresponding to the slice.
 SliceParameters getSliceParameters(int n)
          Get the parameters of a slice.
 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.
 java.lang.String[] getXAxisLabels()
           
 int getXAxisType()
           
 int getXBins()
           
 double getXMax()
           
 double getXMin()
           
 java.lang.String[] getYAxisLabels()
           
 int getYAxisType()
           
 int getYBins()
           
 double getYMax()
           
 double getYMin()
           
 boolean isRebinnable()
           
 double[][][] rebin(int xbins, double xmin, double xmax, int ybins, double ymin, double ymax, boolean wantErrors, boolean hurry, boolean overflow)
           
 void removeSlice(int n)
          Remove a slice from the source
 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 Rebinnable2DHistogramData source
Constructor Detail

TwoDAdapter

public TwoDAdapter(Rebinnable2DHistogramData source)
Method Detail

rebin

public double[][][] rebin(int xbins,
                          double xmin,
                          double xmax,
                          int ybins,
                          double ymin,
                          double ymax,
                          boolean wantErrors,
                          boolean hurry,
                          boolean overflow)
Specified by:
rebin in interface Rebinnable2DHistogramData

getXMin

public double getXMin()
Specified by:
getXMin in interface Rebinnable2DHistogramData

getXMax

public double getXMax()
Specified by:
getXMax in interface Rebinnable2DHistogramData

getYMin

public double getYMin()
Specified by:
getYMin in interface Rebinnable2DHistogramData

getYMax

public double getYMax()
Specified by:
getYMax in interface Rebinnable2DHistogramData

getXBins

public int getXBins()
Specified by:
getXBins in interface Rebinnable2DHistogramData

getYBins

public int getYBins()
Specified by:
getYBins in interface Rebinnable2DHistogramData

isRebinnable

public boolean isRebinnable()
Specified by:
isRebinnable in interface Rebinnable2DHistogramData

getXAxisType

public int getXAxisType()
Specified by:
getXAxisType in interface Rebinnable2DHistogramData

getYAxisType

public int getYAxisType()
Specified by:
getYAxisType in interface Rebinnable2DHistogramData

getXAxisLabels

public java.lang.String[] getXAxisLabels()
Specified by:
getXAxisLabels in interface Rebinnable2DHistogramData

getYAxisLabels

public java.lang.String[] getYAxisLabels()
Specified by:
getYAxisLabels in interface Rebinnable2DHistogramData

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

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

getStatistics

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

toString

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

getNSlices

public int getNSlices()
Description copied from interface: HasSlices
Number of slices currently attached to plot
Specified by:
getNSlices in interface HasSlices

getSliceParameters

public SliceParameters getSliceParameters(int n)
Description copied from interface: HasSlices
Get the parameters of a slice. The SliceParameters can subsequently be changed to update the slice.
Specified by:
getSliceParameters in interface HasSlices
Following copied from interface: jas.hist.HasSlices
Parameters:
n - The index of the slice
Returns:
The Slice parameters of the slice with the specified index

getSlice

public Rebinnable1DHistogramData getSlice(int n)
Description copied from interface: HasSlices
Get the data corresponding to the slice. The data will be observable and will notify its observers if the slice changes, or the data from which the slice is derived changes
Specified by:
getSlice in interface HasSlices
Following copied from interface: jas.hist.HasSlices
Parameters:
n - The index of the slice
Returns:
The data resulting from the slice

canAddRemoveSlices

public boolean canAddRemoveSlices()
Specified by:
canAddRemoveSlices in interface HasSlices

addSlice

public int addSlice(double x,
                    double y,
                    double width,
                    double height,
                    double phi)
Description copied from interface: HasSlices
Create a new slice with the specified initial parameters
Specified by:
addSlice in interface HasSlices
Following copied from interface: jas.hist.HasSlices
Returns:
the index of the slice that was added

removeSlice

public void removeSlice(int n)
Description copied from interface: HasSlices
Remove a slice from the source
Specified by:
removeSlice in interface HasSlices
Following copied from interface: jas.hist.HasSlices
Parameters:
n - The index of the slice