org.opensolaris.os.dtrace
Class AggregationRecord

java.lang.Object
  extended by org.opensolaris.os.dtrace.AggregationRecord
All Implemented Interfaces:
java.io.Serializable, Record

public final class AggregationRecord
extends java.lang.Object
implements Record, java.io.Serializable

A single key-value pair in a DTrace aggregation.

Immutable. Supports persistence using XMLEncoder.

See Also:
Aggregation, Serialized Form

Constructor Summary
AggregationRecord(Tuple tupleKey, AggregationValue recordValue)
          Creates an aggregation record with the given key and value.
AggregationRecord(Tuple tupleKey, AggregationValue recordValue, int n)
          Creates an aggregation record with the given key, value, and ordinal.
 
Method Summary
 boolean equals(java.lang.Object o)
          Compares the specified object with this aggregation record for equality.
 int getOrdinal()
          Gets the ordinal generated when this AggregationRecord was added to its containing Aggregate by the native DTrace library, from zero (first) to n-1 (last).
 Tuple getTuple()
          Gets the multi-element key associated with getValue().
 AggregationValue getValue()
          Gets the value associated with getTuple().
 int hashCode()
          Overridden to ensure that equal records have equal hash codes.
 java.lang.String toString()
          Gets a string representation of this aggregation record 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

AggregationRecord

public AggregationRecord(Tuple tupleKey,
                         AggregationValue recordValue)
Creates an aggregation record with the given key and value. Supports XML persistence.

See Also:
AggregationRecord(Tuple tupleKey, AggregationValue recordValue, int n)

AggregationRecord

public AggregationRecord(Tuple tupleKey,
                         AggregationValue recordValue,
                         int n)
Creates an aggregation record with the given key, value, and ordinal. Supports XML persistence.

Parameters:
tupleKey - aggregation tuple, may be empty (see Tuple.EMPTY) to indicate that this record's value belongs to an unkeyed aggregation declared without square brackets, for example:
         @a = count();
recordValue - aggregated value associated with the given tuple
n - ordinal from zero (first) to n-1 (last) within the Aggregate containing this record
Throws:
java.lang.NullPointerException - if the given key or value is null
java.lang.IllegalArgumentException - if the given ordinal is negative
Method Detail

getTuple

public Tuple getTuple()
Gets the multi-element key associated with getValue().

Returns:
non-null, possibly empty tuple
See Also:
Aggregation.getRecord(Tuple key)

getValue

public AggregationValue getValue()
Gets the value associated with getTuple(). Values generated by the DTrace actions count(), sum(), avg(), min(), and max() are of type Long. Values generated by the DTrace actions quantize() and lquantize() are of type Distribution.

Returns:
non-null value keyed to getTuple()

getOrdinal

public int getOrdinal()
Gets the ordinal generated when this AggregationRecord was added to its containing Aggregate by the native DTrace library, from zero (first) to n-1 (last). The sequence described by an aggregate's record ordinals reflects the setting of the aggsortkey, aggsortkeypos, aggsortpos, and aggsortrev DTrace options and matches the way that the records would be ordered by dtrace(1M).

Returns:
non-negative ordinal from zero (first) to n-1 (last) within the Aggregate containing this record
See Also:
Aggregate.getOrderedRecords()

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this aggregation record for equality. Defines equality as having the same tuple and value.

Overrides:
equals in class java.lang.Object
Returns:
true if and only if the specified object is an AggregationRecord and both records have equal tuples as defined by Tuple.equals(Object o) and equal values as defined by the implementation of AggregationValue

hashCode

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

Overrides:
hashCode in class java.lang.Object

toString

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