org.opensolaris.os.dtrace
Class Distribution

java.lang.Object
  extended by org.opensolaris.os.dtrace.Distribution
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<Distribution.Bucket>, AggregationValue
Direct Known Subclasses:
LinearDistribution, LogDistribution

public abstract class Distribution
extends java.lang.Object
implements AggregationValue, java.lang.Iterable<Distribution.Bucket>, java.io.Serializable

A frequency distribution aggregated by the DTrace quantize() or lquantize() action. Each aggregated value falls into a range known as a bucket and counts toward the frequency of that bucket. Bucket ranges are consecutive, with the maximum of one bucket's range always one less than the minimum of the next bucket's range. By convention each bucket is identified by the minimum of its range.

See Also:
Serialized Form

Nested Class Summary
static class Distribution.Bucket
          A range inclusive at both endpoints and a count of aggregated values that fall in that range.
 
Method Summary
 java.util.List<Distribution.Bucket> asList()
          Gets a read-only List view of this distribution.
 boolean equals(java.lang.Object o)
          Compares the specified object with this Distribution instance for equality.
 Distribution.Bucket get(int index)
          Gets the bucket at the given distribution index (starting at zero).
 java.util.List<Distribution.Bucket> getBuckets()
          Gets a modifiable list of this distribution's buckets ordered by bucket range.
 java.util.List<Distribution.Bucket> getDisplayRange()
          Gets a list of buckets of interest by excluding empty buckets at both ends of the distribution.
 double getTotal()
          Gets the total frequency across all buckets.
abstract  java.lang.Number getValue()
          Gets the numeric value of this distribution used to compare distributions by overall magnitude, defined as the sum total of each bucket's frequency times the minimum of its range.
 int hashCode()
          Overridden to ensure that equals instances have equal hash codes.
 java.util.Iterator<Distribution.Bucket> iterator()
          Gets an iterator over the buckets of this distribution.
 int size()
          Gets the number of buckets in this distribution.
 java.lang.String toString()
          Gets a string representation of this Distribution useful for logging and not intended for display.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getBuckets

public java.util.List<Distribution.Bucket> getBuckets()
Gets a modifiable list of this distribution's buckets ordered by bucket range. Modifying the returned list has no effect on this distribution. Supports XML persistence.

Returns:
a modifiable list of this distribution's buckets ordered by bucket range

asList

public java.util.List<Distribution.Bucket> asList()
Gets a read-only List view of this distribution.

Returns:
a read-only List view of this distribution

size

public int size()
Gets the number of buckets in this distribution.

Returns:
non-negative bucket count

get

public Distribution.Bucket get(int index)
Gets the bucket at the given distribution index (starting at zero).

Returns:
non-null distribution bucket at the given zero-based index

iterator

public java.util.Iterator<Distribution.Bucket> iterator()
Gets an iterator over the buckets of this distribution.

Specified by:
iterator in interface java.lang.Iterable<Distribution.Bucket>
Returns:
an iterator over the buckets of this distribution

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this Distribution instance for equality. Defines equality as having the same buckets with the same values.

Overrides:
equals in class java.lang.Object
Returns:
true if and only if the specified object is of type Distribution and both instances have the same size and equal buckets at corresponding distribution indexes

hashCode

public int hashCode()
Overridden to ensure that equals instances have equal hash codes.

Overrides:
hashCode in class java.lang.Object

getTotal

public double getTotal()
Gets the total frequency across all buckets.

Returns:
sum of the frequency of all buckets in this distribution

getValue

public abstract java.lang.Number getValue()
Gets the numeric value of this distribution used to compare distributions by overall magnitude, defined as the sum total of each bucket's frequency times the minimum of its range.

Specified by:
getValue in interface AggregationValue
Returns:
non-null numeric value

getDisplayRange

public java.util.List<Distribution.Bucket> getDisplayRange()
Gets a list of buckets of interest by excluding empty buckets at both ends of the distribution. Leaves one empty bucket on each end if possible to convey the distribution context more effectively in a display.

Returns:
an unmodifiable sublist that includes the range starting from the first bucket with a non-zero frequency and ending with the last bucket with a non-zero frequency, plus one empty bucket before and after that range if possible

toString

public java.lang.String toString()
Gets a string representation of this Distribution 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