org.ow2.jasmine.monitoring.mbeancmd.audit.util
Class MetricMath

java.lang.Object
  extended by org.ow2.jasmine.monitoring.mbeancmd.audit.util.MetricMath

public class MetricMath
extends java.lang.Object

Author:
waeselyf

Field Summary
static double MIN_RANGE
          Minimal range value
 
Constructor Summary
MetricMath()
           
 
Method Summary
static boolean isNonZero(javax.management.Attribute att)
          test whether attribute value is zero or not
static boolean isNum(java.lang.Object obj)
          Check whether obj is numeric
static double range(double d)
          Returns the range of a double.
static double sum(java.lang.String attr, java.util.LinkedList<Metric> l)
          Computes the sum of the attr attribute for all metrics in l.
static double toDouble(javax.management.Attribute attr)
          Returns the value of attr as a double.
static double toDouble(java.lang.Object o)
          If o is numeric, returns a double representing thhat number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_RANGE

public static final double MIN_RANGE
Minimal range value

See Also:
Constant Field Values
Constructor Detail

MetricMath

public MetricMath()
Method Detail

sum

public static double sum(java.lang.String attr,
                         java.util.LinkedList<Metric> l)
Computes the sum of the attr attribute for all metrics in l.

Parameters:
attr -
l -
Returns:
a double value as the sum

toDouble

public static double toDouble(javax.management.Attribute attr)
Returns the value of attr as a double.

Parameters:
attr -
Returns:
If the attribute value is numeric, returns a double representing this value, else returns zero.

toDouble

public static double toDouble(java.lang.Object o)
If o is numeric, returns a double representing thhat number. If not, returns zero.

Parameters:
o -
Returns:
a double

range

public static double range(double d)
Returns the range of a double.

Parameters:
d -
Returns:
a double according to the following: - If |d| <= 10**(MIN_RANGE) returns MIN_RANGE - otherwise returns log10(d).

isNum

public static boolean isNum(java.lang.Object obj)
Check whether obj is numeric

Parameters:
obj -
Returns:
true or false

isNonZero

public static boolean isNonZero(javax.management.Attribute att)
test whether attribute value is zero or not

Parameters:
att -
Returns:


Copyright © 2009 OW2 Consortium. All Rights Reserved.