Class SummingHistogram.CountOfValues

java.lang.Object
net.algart.arrays.SummingHistogram.CountOfValues
Enclosing class:
SummingHistogram

public static final class SummingHistogram.CountOfValues extends Object

The helper class for static methods of SummingHistogram class, calculating the integrals of v(r) function between two given values: minValuevmaxValue.

More precisely, this class is used by the static methods

and allows to return some additional information. All these methods have two arguments minValue, maxValue and calculate the integral of v(r), defined in comments to Histogram class, in terms of the simple histogram model for first 2 methods or the precise histogram model for the last 2 methods. The integral is calculated between r1=r(maxValue) and r2=r(maxValue), where r(v) is the inverse function to v(r) (see Histogram class). This integral is returned in the result of the methods.

But, while calculating the integral, these methods incidentally calculate the additional information, which is stored in the instance of this class, passed as the last argument, if it is not null. Namely, they calculate:

  • count(): the difference r2r1 = r(maxValue)−r(minValue);
  • isLeftBound() flag: it is true if r(maxValue)=r(minValue)=0 — in other words, if minValue..maxValue range fully lies to the left from the minimal element of the source array A[k];
  • isRightBound() flag: it is true if r(maxValue)=r(minValue)=N — in other words, if minValue..maxValue range fully lies to the right from the maximal element of the source array A[k].

If minValue≥maxValue, these methods always return 0.0 and fill the last argument (if it is not null) by the following values: count()=0, isLeftBound()=false, isRightBound()=false.

Note: in the special case N=0 (all bars b[k] are zero) the values of isLeftBound() and isRightBound() flags are not specified.

The only way to create an instance of this class is the constructor without arguments, that creates an uninitialized instance. "Uninitialized" means that any attempt to read information by count(), isLeftBound() or isRightBound() leads to IllegalStateException. The only way to change the information stored in this instance is calling one of 4 static methods of SummingHistogram class, listed above. These methods change its state to initialized.

This class does not implement own equals and hashCode methods. So, this class does not provide a mechanism for comparing different instances of this class.

This class is not thread-safe, but is thread-compatible and can be synchronized manually, if multithread access is necessary.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates new uninitialized instance of this class.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the difference r(maxValue)−r(minValue).
    boolean
    Returns true if and only this object is initialized.
    boolean
    Returns true if r(maxValue)=r(minValue)=0 — in other words, if minValue..maxValue range fully lies to the left from the minimal element of the source array A[k].
    boolean
    Returns true if r(maxValue)=r(minValue)=N — in other words, if minValue..maxValue range fully lies to the right from the maximal element of the source array A[k].
    Returns a brief string description of this object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait