org.rhq.core.domain.measurement
Enum MeasurementUnits

java.lang.Object
  extended by java.lang.Enum<MeasurementUnits>
      extended by org.rhq.core.domain.measurement.MeasurementUnits
All Implemented Interfaces:
Serializable, Comparable<MeasurementUnits>

public enum MeasurementUnits
extends Enum<MeasurementUnits>

Metric data values can be in one of the following known units of measurement. These enum values should correspond to the "units" attribute enumerated type values as defined in the plugin descriptor's <metric> element.


Nested Class Summary
static class MeasurementUnits.Family
           
static class MeasurementUnits.Scale
           
 
Enum Constant Summary
BITS
           
BYTES
           
CELSIUS
           
DAYS
           
EPOCH_MILLISECONDS
           
EPOCH_SECONDS
           
FAHRENHEIGHT
           
GIGABITS
           
GIGABYTES
           
HOURS
           
JIFFYS
           
KELVIN
           
KILOBITS
           
KILOBYTES
           
MEGABITS
           
MEGABYTES
           
MICROSECONDS
           
MILLISECONDS
           
MINUTES
           
NANOSECONDS
           
NONE
           
PERCENTAGE
           
PETABITS
           
PETABYTES
           
SECONDS
           
TERABITS
           
TERABYTES
           
 
Method Summary
static Double calculateOffset(MeasurementUnits first, MeasurementUnits second)
           
 MeasurementUnits getBaseUnits()
           
 MeasurementUnits.Family getFamily()
           
 String getName()
          A Java bean style getter to allow us to access the enum name from JSPs (e.g.
 MeasurementUnits.Scale getScale()
           
static MeasurementUnits getUsingDisplayUnits(String displayUnits, MeasurementUnits.Family family)
           
 boolean isComparableTo(MeasurementUnits other)
           
static Double scaleDown(Double value, MeasurementUnits units)
           
static Double scaleUp(Double value, MeasurementUnits units)
           
 String toString()
           
static MeasurementUnits valueOf(String name)
          Returns the enum constant of this type with the specified name.
static MeasurementUnits[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NONE

public static final MeasurementUnits NONE

PERCENTAGE

public static final MeasurementUnits PERCENTAGE

BYTES

public static final MeasurementUnits BYTES

KILOBYTES

public static final MeasurementUnits KILOBYTES

MEGABYTES

public static final MeasurementUnits MEGABYTES

GIGABYTES

public static final MeasurementUnits GIGABYTES

TERABYTES

public static final MeasurementUnits TERABYTES

PETABYTES

public static final MeasurementUnits PETABYTES

BITS

public static final MeasurementUnits BITS

KILOBITS

public static final MeasurementUnits KILOBITS

MEGABITS

public static final MeasurementUnits MEGABITS

GIGABITS

public static final MeasurementUnits GIGABITS

TERABITS

public static final MeasurementUnits TERABITS

PETABITS

public static final MeasurementUnits PETABITS

EPOCH_MILLISECONDS

public static final MeasurementUnits EPOCH_MILLISECONDS

EPOCH_SECONDS

public static final MeasurementUnits EPOCH_SECONDS

JIFFYS

public static final MeasurementUnits JIFFYS

NANOSECONDS

public static final MeasurementUnits NANOSECONDS

MICROSECONDS

public static final MeasurementUnits MICROSECONDS

MILLISECONDS

public static final MeasurementUnits MILLISECONDS

SECONDS

public static final MeasurementUnits SECONDS

MINUTES

public static final MeasurementUnits MINUTES

HOURS

public static final MeasurementUnits HOURS

DAYS

public static final MeasurementUnits DAYS

CELSIUS

public static final MeasurementUnits CELSIUS

KELVIN

public static final MeasurementUnits KELVIN

FAHRENHEIGHT

public static final MeasurementUnits FAHRENHEIGHT
Method Detail

values

public static MeasurementUnits[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (MeasurementUnits c : MeasurementUnits.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static MeasurementUnits valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getUsingDisplayUnits

public static MeasurementUnits getUsingDisplayUnits(String displayUnits,
                                                    MeasurementUnits.Family family)

getBaseUnits

public MeasurementUnits getBaseUnits()

isComparableTo

public boolean isComparableTo(MeasurementUnits other)

scaleUp

public static Double scaleUp(Double value,
                             MeasurementUnits units)
Returns:
scaled appropriately for the provided units. non-RELATIVE simply return .

scaleDown

public static Double scaleDown(Double value,
                               MeasurementUnits units)
Returns:
scaled appropriately for the provided units. non-RELATIVE simply return .

calculateOffset

public static Double calculateOffset(MeasurementUnits first,
                                     MeasurementUnits second)
                              throws MeasurementConversionException
Throws:
MeasurementConversionException

getFamily

public MeasurementUnits.Family getFamily()

getScale

public MeasurementUnits.Scale getScale()

getName

public String getName()
A Java bean style getter to allow us to access the enum name from JSPs (e.g. ${measureUnits.name}).

Returns:
the enum name

toString

public String toString()
Overrides:
toString in class Enum<MeasurementUnits>


Copyright © 2008-2009 RHQ Project Advisory Board (Red Hat, Inc.). All Rights Reserved.