hep.aida.ref.histogram
Class FixedAxis

java.lang.Object
  extended by hep.aida.ref.histogram.FixedAxis
All Implemented Interfaces:
IAxis, Serializable

public class FixedAxis
extends Object
implements IAxis, Serializable

Fixed-width axis; A reference implementation of hep.aida.IAxis.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface hep.aida.IAxis
OVERFLOW_BIN, UNDERFLOW_BIN
 
Constructor Summary
FixedAxis(int bins, double min, double max)
          Create an Axis
 
Method Summary
 double binCenter(int index)
          Get the center of the specified bin.
 double binLowerEdge(int index)
          Get the lower edge of a bin.
 int bins()
          Get the number of bins in the Axis.
 double binUpperEdge(int index)
          Get the upper edge of a bin.
 double binWidth(int index)
          Get the bin width.
 int coordToIndex(double coord)
          Get the bin's index corresponding to an axis's value.
 boolean equals(Object o)
          Check if two Axis are equal.
 boolean isFixedBinning()
          Check if the IAxis has fixed binning, i.e.
 double lowerEdge()
          Get the Axis lower edge.
 double upperEdge()
          Get the Axis upper edge.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedAxis

public FixedAxis(int bins,
                 double min,
                 double max)
Create an Axis

Parameters:
bins - Number of bins
min - Minimum for axis
max - Maximum for axis
Method Detail

equals

public boolean equals(Object o)
Check if two Axis are equal.

Overrides:
equals in class Object
Parameters:
o - the Object to check
Returns:
true if o is an instance of FixedAxis and it has the same number of bins, minimum and bin width.

binCenter

public double binCenter(int index)
Description copied from interface: IAxis
Get the center of the specified bin.

Specified by:
binCenter in interface IAxis
Parameters:
index - The bin number: 0 to bins()-1) for the in-range bins or OVERFLOW or UNDERFLOW.
Returns:
The center of the corresponding bin. For in-range bins the middle of the upper and lower edge of the bin is returned; for out-of-range bins +/- infinity is returned.

bins

public int bins()
Get the number of bins in the Axis.

Specified by:
bins in interface IAxis
Returns:
the number of bins.

binLowerEdge

public double binLowerEdge(int index)
Get the lower edge of a bin.

Specified by:
binLowerEdge in interface IAxis
Parameters:
index - the bin's index
Returns:
the bin's lower edge. If index corresponds to the UNDERFLOW_BIN, Double.NEGATIVE_INFINITY is returned. If index corresponds to OVERFLOW_BIN, the upper edge of the axis is returned.

binUpperEdge

public double binUpperEdge(int index)
Get the upper edge of a bin.

Specified by:
binUpperEdge in interface IAxis
Parameters:
index - the bin's index
Returns:
the bin's upper edge. If index corresponds to the OVERFLOW_BIN, Double.POSITIVE_INFINITY is returned. If index corresponds to UNDERFLOW_BIN, the lower edge of the axis is returned.

binWidth

public double binWidth(int index)
Get the bin width.

Specified by:
binWidth in interface IAxis
Parameters:
index - the bin's index. For a Fixed Axis the bin's width is constant.
Returns:
the bin's width.

coordToIndex

public int coordToIndex(double coord)
Get the bin's index corresponding to an axis's value.

Specified by:
coordToIndex in interface IAxis
Parameters:
coord - an axis value
Returns:
the bin's index corresponding to coord

lowerEdge

public double lowerEdge()
Get the Axis lower edge.

Specified by:
lowerEdge in interface IAxis
Returns:
the axis lower edge

upperEdge

public double upperEdge()
Get the Axis upper edge.

Specified by:
upperEdge in interface IAxis
Returns:
the axis upper edge

isFixedBinning

public boolean isFixedBinning()
Description copied from interface: IAxis
Check if the IAxis has fixed binning, i.e. if all the bins have the same width.

Specified by:
isFixedBinning in interface IAxis
Returns:
true if the binning is fixed, false otherwise.


jHepWork 3.2 © jWork.org