org.opensolaris.os.dtrace
Class Distribution.Bucket

java.lang.Object
  extended by org.opensolaris.os.dtrace.Distribution.Bucket
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
Distribution

public static final class Distribution.Bucket
extends java.lang.Object
implements java.io.Serializable

A range inclusive at both endpoints and a count of aggregated values that fall in that range. Buckets in a Distribution are consecutive, such that the max of one bucket is always one less than the min of the next bucket (or Long.MAX_VALUE if it is the last bucket in the Distribution).

Immutable. Supports persistence using XMLEncoder.

See Also:
Serialized Form

Constructor Summary
Distribution.Bucket(long rangeMinimumInclusive, long rangeMaximumInclusive, long valuesInRange)
          Creates a distribution bucket with the given range and frequency.
 
Method Summary
 boolean equals(java.lang.Object o)
          Compares the specified object with this distribution bucket for equality.
 long getFrequency()
          Gets the number of values in a Distribution that fall into the range defined by this bucket.
 long getMax()
          Gets the upper bound of this bucket's range (inclusive).
 long getMin()
          Gets the lower bound of this bucket's range (inclusive).
 int hashCode()
          Overridden to ensure that equal buckets have equal hashcodes.
 java.lang.String toString()
          Gets a string representation of this distribution bucket useful for logging and not intended for display.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Distribution.Bucket

public Distribution.Bucket(long rangeMinimumInclusive,
                           long rangeMaximumInclusive,
                           long valuesInRange)
Creates a distribution bucket with the given range and frequency.

Parameters:
rangeMinimumInclusive - sets the lower bound (inclusive) returned by getMin()
rangeMaximumInclusive - sets the upper bound (inclusive) returned by getMax()
valuesInRange - sets the value frequency in this bucket's range returned by getFrequency()
Throws:
java.lang.IllegalArgumentException - if rangeMaximumInclusive is less than rangeMinimumInclusive
Method Detail

getMin

public long getMin()
Gets the lower bound of this bucket's range (inclusive).


getMax

public long getMax()
Gets the upper bound of this bucket's range (inclusive).


getFrequency

public long getFrequency()
Gets the number of values in a Distribution that fall into the range defined by this bucket.


equals

public boolean equals(java.lang.Object o)
Compares the specified object with this distribution bucket for equality. Defines equality of two distribution buckets as having the same range and the same frequency.

Overrides:
equals in class java.lang.Object
Returns:
false if the specified object is not a Distribution.Bucket

hashCode

public int hashCode()
Overridden to ensure that equal buckets have equal hashcodes.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Gets a string representation of this distribution bucket useful for logging and not intended for display. The exact details of the representation are unspecified and subject to change, but the following format may be regarded as typical:

 class-name[property1 = value1, property2 = value2]
 

Overrides:
toString in class java.lang.Object