Package hep.aida.bin

Class AbstractBin

All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
AbstractBin1D

public abstract class AbstractBin extends PersistentObject
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

    Constructors
    Modifier
    Constructor
    Description
    protected
    Makes this class non instantiable, but still let's others inherit from it.
  • Method Summary

    Modifier and Type
    Method
    Description
    final double
    Returns center(0).
    double
    center(int dimension)
    Returns a custom definable "center" measure; override this method if necessary.
    abstract void
    Removes all elements from the receiver.
    boolean
    equals(Object otherObj)
    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
    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
    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
    Returns the number of elements contained.
    Returns a String representation of the receiver.
    void
    Trims the capacity of the receiver to be the receiver's current size.
    final double
    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

    Methods inherited from class java.lang.Object

    finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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

      public boolean equals(Object otherObj)
      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.
      Overrides:
      equals in class Object
    • 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

      public String toString()
      Returns a String representation of the receiver.
      Overrides:
      toString in class Object
    • 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.