Package hep.aida.bin
Class AbstractBin
java.lang.Object
cern.colt.PersistentObject
hep.aida.bin.AbstractBin
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
AbstractBin1D
Abstract base class for all arbitrary-dimensional bins consumes double elements.
First see the package summary and javadoc tree view to get the broad picture.
This class is fully thread safe (all public methods are synchronized). Thus, you can have one or more threads adding to the bin as well as one or more threads reading and viewing the statistics of the bin while it is filled. For high performance, add data in large chunks (buffers) via method addAllOf rather than piecewise via method add.
- Version:
- 0.9, 03-Jul-99
- See Also:
-
Field Summary
Fields inherited from class cern.colt.PersistentObject
serialVersionUID
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Makes this class non instantiable, but still let's others inherit from it. -
Method Summary
Modifier and TypeMethodDescriptionfinal double
center()
Returns center(0).double
center
(int dimension) Returns a custom definable "center" measure; override this method if necessary.abstract void
clear()
Removes all elements from the receiver.boolean
Returns whether two objects are equal; This default implementation returns true if the other object is a bin and has the same size, value, error and center.final double
error()
Returns error(0).double
error
(int dimension) Returns a custom definable error measure; override this method if necessary.abstract boolean
Returns whether a client can obtain all elements added to the receiver.final double
offset()
Returns offset(0).double
offset
(int dimension) Returns the relative or absolute position for the center of the bin; override this method if necessary.abstract int
size()
Returns the number of elements contained.toString()
Returns a String representation of the receiver.void
Trims the capacity of the receiver to be the receiver's current size.final double
value()
Returns value(0).double
value
(int dimension) Returns a custom definable "value" measure; override this method if necessary.Methods inherited from class cern.colt.PersistentObject
clone
-
Constructor Details
-
AbstractBin
protected AbstractBin()Makes this class non instantiable, but still let's others inherit from it.
-
-
Method Details
-
center
public final double center()Returns center(0). -
center
public double center(int dimension) Returns a custom definable "center" measure; override this method if necessary. Returns the absolute or relative center of this bin. For example, the center of gravity. The real absolute center can be obtained as follow: partition(i).min(j) * bin(j).offset() + bin(j).center(i), where i is the dimension. and j is the index of this bin.This default implementation always returns 0.5.
- Parameters:
dimension
- the dimension to be considered (zero based).
-
clear
public abstract void clear()Removes all elements from the receiver. The receiver will be empty after this call returns. -
equals
Returns whether two objects are equal; This default implementation returns true if the other object is a bin and has the same size, value, error and center. -
error
public final double error()Returns error(0). -
error
public double error(int dimension) Returns a custom definable error measure; override this method if necessary. This default implementation always returns 0.- Parameters:
dimension
- the dimension to be considered.
-
isRebinnable
public abstract boolean isRebinnable()Returns whether a client can obtain all elements added to the receiver. In other words, tells whether the receiver internally preserves all added elements. If the receiver is rebinnable, the elements can be obtained via elements() methods. -
offset
public final double offset()Returns offset(0). -
offset
public double offset(int dimension) Returns the relative or absolute position for the center of the bin; override this method if necessary. Returns 1.0 if a relative center is stored in the bin. Returns 0.0 if an absolute center is stored in the bin.This default implementation always returns 1.0 (relative).
- Parameters:
dimension
- the index of the considered dimension (zero based);
-
size
public abstract int size()Returns the number of elements contained. -
toString
Returns a String representation of the receiver. -
trimToSize
public void trimToSize()Trims the capacity of the receiver to be the receiver's current size. Releases any superfluos internal memory. An application can use this operation to minimize the storage of the receiver. This default implementation does nothing. -
value
public final double value()Returns value(0). -
value
public double value(int dimension) Returns a custom definable "value" measure; override this method if necessary.This default implementation always returns 0.0.
- Parameters:
dimension
- the dimension to be considered.
-