biz.hammurapi.metrics
Class SimpleMetric

java.lang.Object
  extended by biz.hammurapi.metrics.SimpleMetric
All Implemented Interfaces:
Metric, java.io.Serializable, java.lang.Comparable

public class SimpleMetric
extends java.lang.Object
implements Metric, java.lang.Comparable, java.io.Serializable

Version:
$Revision: 1.8 $
Author:
Pavel Vlasov
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface biz.hammurapi.metrics.Metric
Metric.Measurement
 
Constructor Summary
SimpleMetric(java.lang.String name)
           
SimpleMetric(java.lang.String name, boolean keepMeasurements)
           
 
Method Summary
 void add(double value, long time)
          Adds measurement
 void add(Metric metric)
          Adds another metric (aggregates)
protected  void addMeasurement(Metric.Measurement measurement)
           
 int compareTo(java.lang.Object o)
           
 double getAvg()
           
 double getDeviation()
           
 double getMax()
           
 java.util.Collection getMeasurements()
           
 double getMin()
           
 java.lang.String getName()
           
 int getNumber()
           
 double getTotal()
           
protected  Metric.Measurement newMeasurement(double value, long time)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleMetric

public SimpleMetric(java.lang.String name)

SimpleMetric

public SimpleMetric(java.lang.String name,
                    boolean keepMeasurements)
Method Detail

getNumber

public int getNumber()
Specified by:
getNumber in interface Metric
Returns:
number of measurements

getMin

public double getMin()
Specified by:
getMin in interface Metric
Returns:
Minimum value

getMax

public double getMax()
Specified by:
getMax in interface Metric
Returns:
Maximum value

getAvg

public double getAvg()
Specified by:
getAvg in interface Metric
Returns:
Average

getTotal

public double getTotal()
Specified by:
getTotal in interface Metric
Returns:
Sum of values from all measurements

add

public void add(double value,
                long time)
Description copied from interface: Metric
Adds measurement

Specified by:
add in interface Metric
Parameters:
value - value

addMeasurement

protected void addMeasurement(Metric.Measurement measurement)
Parameters:
value -
measurement -

newMeasurement

protected Metric.Measurement newMeasurement(double value,
                                            long time)
Parameters:
value -
time -
Returns:

add

public void add(Metric metric)
Description copied from interface: Metric
Adds another metric (aggregates)

Specified by:
add in interface Metric

getMeasurements

public java.util.Collection getMeasurements()
Specified by:
getMeasurements in interface Metric
Returns:
Collection of Metric.Measurement

getName

public java.lang.String getName()
Specified by:
getName in interface Metric

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

getDeviation

public double getDeviation()
Specified by:
getDeviation in interface Metric
Returns:
average distance from average


Copyright © 2003 Hammurapi Group. All Rights Reserved.