org.modeshape.common.statistic

## Class Histogram<T extends Number>

- java.lang.Object
- - org.modeshape.common.statistic.Histogram<T>

- Type Parameters:
    `T` - the type of value

      @NotThreadSafe
      public class Histogram<T extends Number>
      extends Object

  A representation of a histogram of values.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `Histogram.Bucket` Represents a bucket in a histogram.
    `class` | `Histogram.BucketingStrategy`
    `class` | `Histogram.DefaultBucketingStrategy`
    `class` | `Histogram.ExplicitBucketingStrategy`
    `class` | `Histogram.StandardDeviationBucketingStrategy`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_BUCKET_COUNT`
    `static int` | `DEFAULT_SIGNIFICANT_FIGURES`
    `protected MathOperations<T>` | `math`
    `protected List<T>` | `values`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Histogram(MathOperations<T> operations, List<T> values)`
    `Histogram(MathOperations<T> operations, T... values)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `compute()`
    `protected static <T> List<T>` | `getBucketBoundaries(MathOperations<T> math, T lowerBound, T upperBound, T actualMinimum, T actualMaximum, int bucketCount, int bucketWidthSigFigs)`
    `int` | `getBucketCount()` Return the number of buckets in this histogram.
    `List<Histogram.Bucket>` | `getBuckets()` Get the buckets in this histogram.
    `MathOperations<T>` | `getMathOperations()`
    `protected long` | `getMaximumCount()`
    `protected float` | `getMaximumPercentage()`
    `int` | `getSignificantFigures()`
    `Histogram.BucketingStrategy` | `getStrategy()`
    `List<String>` | `getTextGraph(int maxBarLength)` Generate a textual (horizontal) bar graph of this histogram.
    `long` | `getTotalNumberOfValues()` Return the total number of values that have gone into this histogram.
    `Histogram<T>` | `setBucketCount(int count)` Set the number of buckets that this histogram will use.
    `Histogram<T>` | `setSignificantFigures(int significantFigures)` Set the number of significant figures used in the calculation of the bucket widths.
    `void` | `setStrategy(double median, double standardDeviation, int sigma)` Set the histogram to use the standard deviation to determine the bucket sizes.
    `void` | `setStrategy(T minimum, T maximum)` Set the histogram to use the supplied minimum and maximum values to determine the bucket size.
    `void` | `setStrategyToDefault()` Set the histogram to use the actual minimum and maximum values to determine the bucket sizes.

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### DEFAULT_BUCKET_COUNT

          public static final int DEFAULT_BUCKET_COUNT

      See Also:
        Constant Field Values

    - #### DEFAULT_SIGNIFICANT_FIGURES

          public static final int DEFAULT_SIGNIFICANT_FIGURES

      See Also:
        Constant Field Values

    - #### math

          protected final MathOperations<T extends Number> math

    - #### values

          protected final List<T extends Number> values

  - ### Constructor Detail

    - #### Histogram

          public Histogram(MathOperations<T> operations,
                   List<T> values)

    - #### Histogram

          public Histogram(MathOperations<T> operations,
                   T... values)

  - ### Method Detail

    - #### getStrategy

          public Histogram.BucketingStrategy getStrategy()

    - #### getMathOperations

          public MathOperations<T> getMathOperations()

      Returns:
        math

    - #### setStrategy

          public void setStrategy(double median,
                         double standardDeviation,
                         int sigma)

      Set the histogram to use the standard deviation to determine the bucket sizes.
      Parameters:
        `median` -
        `standardDeviation` -
        `sigma` -

    - #### setStrategy

          public void setStrategy(T minimum,
                         T maximum)

      Set the histogram to use the supplied minimum and maximum values to determine the bucket size.
      Parameters:
        `minimum` -
        `maximum` -

    - #### setStrategyToDefault

          public void setStrategyToDefault()

      Set the histogram to use the actual minimum and maximum values to determine the bucket sizes.

    - #### getSignificantFigures

          public int getSignificantFigures()

    - #### setSignificantFigures

          public Histogram<T> setSignificantFigures(int significantFigures)

      Set the number of significant figures used in the calculation of the bucket widths.
      Parameters:
        `significantFigures` - the number of significant figures for the bucket widths
      Returns:
        this histogram, useful for method-chaining
      See Also:
        `DEFAULT_SIGNIFICANT_FIGURES`

    - #### getBucketCount

          public int getBucketCount()

      Return the number of buckets in this histogram.
      Returns:
        the number of buckets.

    - #### setBucketCount

          public Histogram<T> setBucketCount(int count)

      Set the number of buckets that this histogram will use.
      Parameters:
        `count` - the number of buckets
      Returns:
        this histogram, useful for method-chaining
      See Also:
        `DEFAULT_BUCKET_COUNT`

    - #### getBuckets

          public List<Histogram.Bucket> getBuckets()

      Get the buckets in this histogram. If the histogram has not yet been computed, this method will cause it to be generated. The resulting list should not be modified.
      Returns:
        the histogram buckets.

    - #### compute

          protected void compute()

    - #### getTotalNumberOfValues

          public long getTotalNumberOfValues()

      Return the total number of values that have gone into this histogram.
      Returns:
        the total number of values
      See Also:
        `Histogram.Bucket.getPercentageOfValues()`

    - #### getMaximumPercentage

          protected float getMaximumPercentage()

    - #### getMaximumCount

          protected long getMaximumCount()

    - #### getTextGraph

          public List<String> getTextGraph(int maxBarLength)

      Generate a textual (horizontal) bar graph of this histogram.
      Parameters:
        `maxBarLength` - the maximum bar length, or 0 if the bar length is to represent actual counts
      Returns:
        the strings that make up the histogram

    - #### getBucketBoundaries

          protected static <T> List<T> getBucketBoundaries(MathOperations<T> math,
                                        T lowerBound,
                                        T upperBound,
                                        T actualMinimum,
                                        T actualMaximum,
                                        int bucketCount,
                                        int bucketWidthSigFigs)

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.