AbstractBin
cern.hep.aida.bin

Class AbstractBin

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


    public abstract class AbstractBinextends 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.

    See Also:
    Serialized Form
    • Method Summary

      Methods 
      Modifier and TypeMethod and Description
      doublecenter()
      Returns center(0).
      doublecenter(int dimension)
      Returns a custom definable "center" measure; override this method if necessary.
      abstract voidclear()
      Removes all elements from the receiver.
      booleanequals(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.
      doubleerror()
      Returns error(0).
      doubleerror(int dimension)
      Returns a custom definable error measure; override this method if necessary.
      abstract booleanisRebinnable()
      Returns whether a client can obtain all elements added to the receiver.
      doubleoffset()
      Returns offset(0).
      doubleoffset(int dimension)
      Returns the relative or absolute position for the center of the bin; override this method if necessary.
      abstract intsize()
      Returns the number of elements contained.
      StringtoString()
      Returns a String representation of the receiver.
      voidtrimToSize()
      Trims the capacity of the receiver to be the receiver's current size.
      doublevalue()
      Returns value(0).
      doublevalue(int dimension)
      Returns a custom definable "value" measure; override this method if necessary.
    • Method Detail

      • 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.

SCaVis 2.0 © jWork.ORG