Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.util.profiling
Class Distribution

    java.lang.Object
      avrora.util.profiling.DataItem
          avrora.util.profiling.MinMaxMean
              avrora.util.profiling.Distribution

public class Distribution
extends MinMaxMean

This class keeps track of the min, max, and median of a stream of integers, as well as the distribution of each. The distribution aids in computing the median without having to store the sequence of integers.

Field Summary
`int[]` | `distrib` The `distrib` field stores an array that records the number of occurrences for each value in the distribution.
`int` | `distribMin` The `distribMin` field stores the value corresponding to expr 0 in the `distrib` array.
`protected java.lang.String` | `distribname` The `distribname` field stores the string that should be reported as the name of the distribution, e.g.
`int` | `median` The `median` field stores the median value of the distribution.

Fields inherited from class avrora.util.profiling.MinMaxMean
`accumulation, countMaximum, countMinimum, cumulname, mean, observedMaximum, observedMinimum, someData, total, totalname`

Fields inherited from class avrora.util.profiling.DataItem
`name`

Constructor Summary
`Distribution(java.lang.String name)` This is the public constructor.
`Distribution(java.lang.String newname, java.lang.String tn, java.lang.String cn)` Public constructor initializes the statistics for a sequence of integers.
`Distribution(java.lang.String newname, java.lang.String tn, java.lang.String cn, java.lang.String dn)` Public constructor initializes the statistics for a sequence of integers.

Method Summary
`void` | `expandInterval(int min, int max)`
`protected void` | `incrementDistrib(int value)` Increment the number of occurrences for a particular integer.
`MinMaxMean` | `merge(MinMaxMean m)` Merge this statistical information with another.
`protected void` | `printDistribution(int base, int[] data)` Print the distribution using stars
`void` | `processData()` process the data so far and update internal statistics.
`protected void` | `recomputeMaxDistrib(int newMax)` Resize the occurrence table with a new maximum value.
`protected void` | `recomputeMinDistrib(int newMin)` Resize the occurences table with the given new minimum.
`void` | `record(int value)` Record the next value and update internal state.
`void` | `textReport()` Generate a textual report of the data gathered.

Methods inherited from class avrora.util.profiling.MinMaxMean
`hasData, toString`

Methods inherited from class avrora.util.profiling.DataItem
`getName`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### distrib

    public int[] distrib

  The `distrib` field stores an array that records the number of occurrences for each value in the distribution. The `distribMin` field stores the value which corresponds to expr 0 in the array. Therefore, `distrib[myval - distribMin]` contains the count for `myval`, provided that the array is large enough. Values outside the array have have a count of zero.

### median

    public int median

  The `median` field stores the median value of the distribution. This field is not computed until the `processData()` method has been called after data has been collected.

### distribMin

    public int distribMin

  The `distribMin` field stores the value corresponding to expr 0 in the `distrib` array.

### distribname

    protected java.lang.String distribname

  The `distribname` field stores the string that should be reported as the name of the distribution, e.g. "Distribution of hashcodes". When this string is non-null, a textual table of the distribution will be printed to the terminal when the `textReport()` method is called.

Constructor Detail

### Distribution

    public Distribution(java.lang.String name)

  This is the public constructor.

### Distribution

    public Distribution(java.lang.String newname,
                        java.lang.String tn,
                        java.lang.String cn)

  Public constructor initializes the statistics for a sequence of integers.

### Distribution

    public Distribution(java.lang.String newname,
                        java.lang.String tn,
                        java.lang.String cn,
                        java.lang.String dn)

  Public constructor initializes the statistics for a sequence of integers.

Method Detail

### record

    public void record(int value)

  Record the next value and update internal state.

  Overrides:
    `record` in class `MinMaxMean`

### textReport

    public void textReport()

  Generate a textual report of the data gathered.

  Overrides:
    `textReport` in class `MinMaxMean`

### printDistribution

    protected void printDistribution(int base,
                                     int[] data)

  Print the distribution using stars

### expandInterval

    public void expandInterval(int min,
                               int max)

### incrementDistrib

    protected void incrementDistrib(int value)

  Increment the number of occurrences for a particular integer.

### recomputeMaxDistrib

    protected void recomputeMaxDistrib(int newMax)

  Resize the occurrence table with a new maximum value.

### recomputeMinDistrib

    protected void recomputeMinDistrib(int newMin)

  Resize the occurences table with the given new minimum.

### processData

    public void processData()

  Description copied from class: `MinMaxMean`
  process the data so far and update internal statistics.

  Overrides:
    `processData` in class `MinMaxMean`

### merge

    public MinMaxMean merge(MinMaxMean m)

  Merge this statistical information with another.

  Overrides:
    `merge` in class `MinMaxMean`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD