Package org.opensolaris.os.dtrace
Class AvgValue
- java.lang.Object
-
- org.opensolaris.os.dtrace.AvgValue
-
- All Implemented Interfaces:
java.io.Serializable
,AggregationValue
public final class AvgValue extends java.lang.Object
Along
value aggregated by the DTraceavg()
action.Immutable. Supports persistence using
XMLEncoder
.- See Also:
Aggregation
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AvgValue(long v, long averagedTotal, long averagedValueCount)
Creates a value aggregated by the DTraceavg()
action.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Compares the specified object with this aggregation value for equality.long
getCount()
Gets the number of aggregated values included in the average.long
getTotal()
Gets the sum total of the aggregated values.java.lang.Long
getValue()
Gets the average of the aggregated values.int
hashCode()
Overridden to ensure that equal instances have equal hash codes.java.lang.String
toString()
Gets the string representation ofAggregationValue.getValue()
.
-
-
-
Constructor Detail
-
AvgValue
public AvgValue(long v, long averagedTotal, long averagedValueCount)
Creates a value aggregated by the DTraceavg()
action. Supports XML persistence.- Parameters:
v
- averageaveragedTotal
- sum total of all values averagedaveragedValueCount
- number of values averaged- Throws:
java.lang.IllegalArgumentException
- if the given count is negative or if the given average is not the value expected for the given total and count
-
-
Method Detail
-
getValue
public java.lang.Long getValue()
Gets the average of the aggregated values.- Specified by:
getValue
in interfaceAggregationValue
- Returns:
- average of the aggregated values, equal to
(
rounded downgetTotal()
/getCount()
)
-
getTotal
public long getTotal()
Gets the sum total of the aggregated values.- Returns:
- the sum total of the aggregated values
-
getCount
public long getCount()
Gets the number of aggregated values included in the average.- Returns:
- the number of aggregated values included in the average
-
equals
public boolean equals(java.lang.Object o)
Compares the specified object with this aggregation value for equality. Defines equality as having the same type and the same numeric value.- Overrides:
equals
in classjava.lang.Object
- Returns:
true
if and only if the specified object is an aggregation value of the sameClass
as this value, and both values return equal numbers fromAggregationValue.getValue()
.
-
hashCode
public int hashCode()
Overridden to ensure that equal instances have equal hash codes.- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
Gets the string representation ofAggregationValue.getValue()
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string representation of
AggregationValue.getValue()
returned byObject.toString()
-
-