hep.analysis.partition
Class Abstract2DPartition

java.lang.Object
  |
  +--java.util.Observable
        |
        +--hep.analysis.Partition
              |
              +--hep.analysis.partition.Abstract2DPartition
All Implemented Interfaces:
OneDFillable, java.io.Serializable, StatisticsProvider, TwoDDataSource, TwoDFillable
Direct Known Subclasses:
Simple2DPartition, TwoDDelegatingPartition

public abstract class Abstract2DPartition
extends Partition
implements TwoDDataSource

The base class for all two-dimensional partitions. All fill methods will throw a PartitionFillException if not overridden. Therefore, subclasses should override the methods corresponding to the data types the subclass supports and leave the remaining ones to throw exceptions. Similarly, all getBinAt methods throw a NoSuchBinException unless overridden so subclasses should override the methods corresponding to the types that the subclass supports.

See Also:
PartitionFillException, NoSuchBinException, Serialized Form

Field Summary
protected  boolean m_dataChanged
           
protected  boolean m_dataFinalChangedNotificationSent
           
protected  boolean m_dataNotificationSent
           
protected  boolean m_rangeFinalChangedNotificationSent
           
protected  boolean m_xAxisChanged
           
protected  boolean m_xAxisNotificationSent
           
protected  boolean m_yAxisChanged
           
protected  boolean m_yAxisNotificationSent
           
 
Fields inherited from class hep.analysis.Partition
DATE, DELTATIME, DOUBLE, HORIZONTAL_AXIS, INTEGER, m_owner, STRING, VERTICAL_AXIS
 
Constructor Summary
Abstract2DPartition()
           
 
Method Summary
 void clear()
          Resets the partition to default settings.
 void clearChanges()
           
protected  void clearDataChanged()
          Indicate that all data changes have been acknowledged by the observer and that the partition should resume sending new updates.
 void done()
          Called when event loop is finished; sends a final update of any range and/or data change.
 void fill(java.util.Date x)
          Invokes the fill(Date, double) method with a weighting value of 1.
 void fill(java.util.Date x, double y)
           
 void fill(double x)
          Invokes the fill(double, double) method with a weighting value of 1.
 void fill(double x, double y)
           
 void fill(int x)
          Invokes the fill(int, double) method with a weighting value of 1.
 void fill(java.lang.String x)
          Invokes the fill(String, double) method with a weighting value of 1.
 void fillW(java.util.Date x, double v)
          Fills the associated histogram with a date value.
 void fillW(java.util.Date x, double y, double weight)
           
 void fillW(double x, double v)
          Fills the associated histogram with a numerical value.
 void fillW(double x, double y, double weight)
           
 void fillW(int x, double v)
          Converts the given int parameter to type double and calls fill(double, double).
 void fillW(java.lang.String x, double v)
          Fills the associated histogram with a string value.
 double getBin(int binX, int binY)
           
abstract  int getNumberOfXBins()
          Return the number of bins.
abstract  int getNumberOfYBins()
           
protected  RangeChangeListener getRangeChangeListener(int axis)
           
 java.lang.String[] getXAxisLabels()
          Override to allow axis labels to be accessed.
 int getXAxisType()
          Get the axis type
 java.lang.String[] getYAxisLabels()
           
 int getYAxisType()
           
 boolean hasAsymmetricErrorBars()
          Returns false by default.
 boolean hasSimpleQuadraticErrorBars()
          Returns false by default.
 boolean isRebinnable()
          Returns false by default.
 void notifyObservers(java.lang.Object arg)
           
protected  void setBothRangesChanged()
           
protected  void setDataAndRangeChangedNow()
          Indicate that the data and range have changed and notify observers of the change with a final update.
 void setDataChanged()
           
 void setXBinning(int bins, double min, double max)
          Override to allow binning to be set.
protected  void setXRangeChanged()
           
 void setYBinning(int bins, double min, double max)
           
protected  void setYRangeChanged()
           
 
Methods inherited from class hep.analysis.Partition
destroy, getStyle, makeCopy, setStyle
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hep.analysis.partition.TwoDDataSource
getBins, getMinusErrors, getPlusErrors, getXMax, getXMin, getYMax, getYMin
 
Methods inherited from interface hep.analysis.partition.StatisticsProvider
getStatistics
 

Field Detail

m_dataChanged

protected transient boolean m_dataChanged

m_xAxisChanged

protected transient boolean m_xAxisChanged

m_yAxisChanged

protected transient boolean m_yAxisChanged

m_dataNotificationSent

protected transient boolean m_dataNotificationSent

m_xAxisNotificationSent

protected transient boolean m_xAxisNotificationSent

m_yAxisNotificationSent

protected transient boolean m_yAxisNotificationSent

m_dataFinalChangedNotificationSent

protected transient boolean m_dataFinalChangedNotificationSent

m_rangeFinalChangedNotificationSent

protected transient boolean m_rangeFinalChangedNotificationSent
Constructor Detail

Abstract2DPartition

public Abstract2DPartition()
Method Detail

fillW

public void fillW(double x,
                  double v)
Fills the associated histogram with a numerical value. Subclasses must override this method with a partition-specific implementation to prevent a PartitionFillException (i.e., override this method if your subclass will support numerical binning).
Parameters:
x - the value to fill
v - a partition-specific value (normally some weighting value)
Throws:
PartitionFillException - if this method is not overridden
See Also:
PartitionFillException

fillW

public void fillW(int x,
                  double v)
Converts the given int parameter to type double and calls fill(double, double).
Parameters:
x - the value to fill
v - a partition-specific value (normally some weighting value)
Throws:
PartitionFillException - if thrown from fill(double, double)
See Also:
fill(double, double), PartitionFillException

fillW

public void fillW(java.lang.String x,
                  double v)
Fills the associated histogram with a string value. Subclasses must override this method with a partition-specific implementation to prevent a PartitionFillException (i.e., override this method if your subclass will support string binning).
Parameters:
x - the value to fill
v - a partition-specific value (normally some weighting value)
Throws:
PartitionFillException - if not overridden
See Also:
PartitionFillException

fillW

public void fillW(java.util.Date x,
                  double v)
Fills the associated histogram with a date value. Subclasses must override this method with a partition-specific implementation to prevent a PartitionFillException (i.e., override this method if your subclass will support date binning).
Parameters:
x - the value to fill
v - a partition-specific value (normally some weighting value)
Throws:
PartitionFillException - if not overridden
See Also:
PartitionFillException

fill

public void fill(double x)
Invokes the fill(double, double) method with a weighting value of 1.
Parameters:
x - the value to fill
See Also:
fillW(double, double)

fill

public void fill(int x)
Invokes the fill(int, double) method with a weighting value of 1.
Parameters:
x - the value to fill
See Also:
fillW(int, double)

fill

public void fill(java.lang.String x)
Invokes the fill(String, double) method with a weighting value of 1.
Parameters:
x - the value to fill
See Also:
fillW(String, double)

fill

public void fill(java.util.Date x)
Invokes the fill(Date, double) method with a weighting value of 1.
Parameters:
x - the value to fill
See Also:
fillW(Date, double)

fill

public void fill(double x,
                 double y)

fillW

public void fillW(double x,
                  double y,
                  double weight)

fill

public void fill(java.util.Date x,
                 double y)

fillW

public void fillW(java.util.Date x,
                  double y,
                  double weight)

getBin

public double getBin(int binX,
                     int binY)
              throws NoSuchBinException

isRebinnable

public boolean isRebinnable()
Returns false by default. Override to have a rebinnable partition.
Specified by:
isRebinnable in interface TwoDDataSource

setXBinning

public void setXBinning(int bins,
                        double min,
                        double max)
Override to allow binning to be set. Throws an UnsupportedPartitionMethodException by default.
Specified by:
setXBinning in interface TwoDDataSource
Parameters:
bins - the number of bins to have
min - the minimum of the partition range
max - the maximum of the partition range
Throws:
UnsupportedPartitionMethodException - if not overridden.

setYBinning

public void setYBinning(int bins,
                        double min,
                        double max)
Specified by:
setYBinning in interface TwoDDataSource

getXAxisType

public int getXAxisType()
Get the axis type
Specified by:
getXAxisType in interface TwoDDataSource

getYAxisType

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

hasAsymmetricErrorBars

public boolean hasAsymmetricErrorBars()
Returns false by default. Override to have asymmetric error bars.
Specified by:
hasAsymmetricErrorBars in interface TwoDDataSource

hasSimpleQuadraticErrorBars

public boolean hasSimpleQuadraticErrorBars()
Returns false by default. Override to have simple quadratic error bars.
Specified by:
hasSimpleQuadraticErrorBars in interface TwoDDataSource

getXAxisLabels

public java.lang.String[] getXAxisLabels()
Override to allow axis labels to be accessed. Throws an UnsupportedPartitionMethodException by default.
Specified by:
getXAxisLabels in interface TwoDDataSource
Returns:
an array of axis labels

getYAxisLabels

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

getNumberOfXBins

public abstract int getNumberOfXBins()
Return the number of bins.

getNumberOfYBins

public abstract int getNumberOfYBins()

getRangeChangeListener

protected RangeChangeListener getRangeChangeListener(int axis)

setBothRangesChanged

protected void setBothRangesChanged()

setXRangeChanged

protected void setXRangeChanged()

setYRangeChanged

protected void setYRangeChanged()

setDataChanged

public void setDataChanged()

clearDataChanged

protected void clearDataChanged()
Indicate that all data changes have been acknowledged by the observer and that the partition should resume sending new updates.

clearChanges

public void clearChanges()

clear

public void clear()
Resets the partition to default settings.
Overrides:
clear in class Partition

setDataAndRangeChangedNow

protected final void setDataAndRangeChangedNow()
Indicate that the data and range have changed and notify observers of the change with a final update.

done

public void done()
Called when event loop is finished; sends a final update of any range and/or data change.
Overrides:
done in class Partition

notifyObservers

public final void notifyObservers(java.lang.Object arg)
Overrides:
notifyObservers in class java.util.Observable