org.apache.cassandra.utils

## Class StreamingHistogram

- java.lang.Object
- - org.apache.cassandra.utils.StreamingHistogram

    public class StreamingHistogram
    extends java.lang.Object

Histogram that can be constructed from streaming of data. The algorithm is taken from following paper: Yael Ben-Haim and Elad Tom-Tov, "A Streaming Parallel Decision Tree Algorithm" (2010) http://jmlr.csail.mit.edu/papers/volume11/ben-haim10a/ben-haim10a.pdf

### Nested Class Summary

Nested Classes
`static class` `StreamingHistogram.StreamingHistogramSerializer`

### Field Summary

Fields
`static StreamingHistogram.StreamingHistogramSerializer` `serializer`

### Constructor Summary

Constructors
Constructor and Description
`StreamingHistogram(int maxBinSize)` Creates a new histogram with max bin size of maxBinSize

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `equals(java.lang.Object o)`
`java.util.Map<java.lang.Double,java.lang.Long>` `getAsMap()`
`int` `hashCode()`
`void` `merge(StreamingHistogram other)` Merges given histogram with this histogram.
`double` `sum(double b)` Calculates estimated number of points in interval [-inf,b].
`void` `update(double p)` Adds new point p to this histogram.
`void` `update(double p, long m)` Adds new point p with value m to this histogram.

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

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

### Field Detail

#### serializer

    public static final StreamingHistogram.StreamingHistogramSerializer serializer

### Constructor Detail

#### StreamingHistogram

    public StreamingHistogram(int maxBinSize)

Creates a new histogram with max bin size of maxBinSize

Parameters:
  `maxBinSize` - maximum number of bins this histogram can have

### Method Detail

#### update

    public void update(double p)

Adds new point p to this histogram.

Parameters:
  `p` -

#### update

    public void update(double p,
                       long m)

Adds new point p with value m to this histogram.

Parameters:
  `p` -
  `m` -

#### merge

    public void merge(StreamingHistogram other)

Merges given histogram with this histogram.

Parameters:
  `other` - histogram to merge

#### sum

    public double sum(double b)

Calculates estimated number of points in interval [-inf,b].

Parameters:
  `b` - upper bound of a interval to calculate sum
Returns:
  estimated number of points in a interval [-inf,b].

#### getAsMap

    public java.util.Map<java.lang.Double,java.lang.Long> getAsMap()

#### equals

    public boolean equals(java.lang.Object o)

Overrides:
  `equals` in class `java.lang.Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`