org.javasimon.callback.quantiles
Class Bucket

java.lang.Object
  extended by org.javasimon.callback.quantiles.Bucket

public final class Bucket
extends Object

Bucket count the number of samples in the range min-max.

Since:
3.2
Author:
gquintana

Field Summary
private  int count
          Number of values in the range min-max.
private  long max
          Maximal value.
private  long min
          Minimal value.
 
Constructor Summary
Bucket(long min, long max)
          Constructor with min/max value specified.
 
Method Summary
 boolean addValue(long value)
          Check if value is in range and increment value number.
 void clear()
          Resets value number.
 boolean contains(long value)
          Check whether value is in the range.
 int getCount()
          Get number of values in the range.
 long getMax()
          Get upper bound of the range.
 long getMin()
          Get lower bound of the range.
 void incrementCount()
          Increment value number
 BucketSample sample()
          Get sample from this bucket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

min

private final long min
Minimal value.


max

private final long max
Maximal value.


count

private int count
Number of values in the range min-max.

Constructor Detail

Bucket

public Bucket(long min,
              long max)
Constructor with min/max value specified.

Parameters:
min - min value
max - max value
Method Detail

getCount

public int getCount()
Get number of values in the range.

Returns:
number of value in the range

getMax

public long getMax()
Get upper bound of the range.

Returns:
max value

getMin

public long getMin()
Get lower bound of the range.

Returns:
min value

contains

public boolean contains(long value)
Check whether value is in the range.

Parameters:
value - Value
Returns:
true if in range

incrementCount

public void incrementCount()
Increment value number


addValue

public boolean addValue(long value)
Check if value is in range and increment value number.

Parameters:
value - added value
Returns:
true if value is in bucket range (count was increased)

clear

public void clear()
Resets value number.


sample

public BucketSample sample()
Get sample from this bucket

Returns:
Sample


Copyright © 2013. All Rights Reserved.