UnitsConvert (Hyperic HQ Plugin API)
Keywords: org.hyperic.hq.measurement.UnitsConvert class

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hyperic.hq.measurement
Class UnitsConvert

    java.lang.Object
      org.hyperic.hq.measurement.UnitsConvert

    public class UnitsConvert

extends java.lang.Object

Method Summary
`static FormattedNumber` | `convert(double val, java.lang.String units)`
`static FormattedNumber` | `convert(double val, java.lang.String units, FormatSpecifics specifics)` Convert the value into a string based on the specified units.
`static FormattedNumber` | `convert(double val, java.lang.String units, java.util.Locale locale)` Convert the value into a string based on the specified units.
`static FormattedNumber` | `convert(double val, java.lang.String units, java.util.Locale locale, FormatSpecifics specifics)` Convert the value into a string based on the specified units.
`static FormattedNumber[]` | `convertSame(double[] vals, java.lang.String units, java.util.Locale locale)` Format multiple values into approximated values, all of which use the same unit.
`static FormattedNumber[]` | `convertSame(double[] vals, java.lang.String units, java.util.Locale locale, FormatSpecifics specifics)`
`static int` | `getScaleForUnit(java.lang.String unit)` Return the corresponding scale constant from `UnitsConstants` for the given unit.
`static int` | `getUnitForUnit(java.lang.String unit)` Return the corresponding unit constant from `UnitsConstants` for the given unit.
`static void` | `main(java.lang.String[] args)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getUnitForUnit

    public static int getUnitForUnit(java.lang.String unit)

  Return the corresponding unit constant from `UnitsConstants` for the given unit.

  Parameters:
    `unit` - the unit
  Returns:
    the corresponding `UnitsConstants` unit
  See Also:
    `UnitsConstants`

### getScaleForUnit

    public static int getScaleForUnit(java.lang.String unit)

  Return the corresponding scale constant from `UnitsConstants` for the given unit.

  Parameters:
    `unit` - the unit
  Returns:
    the corresponding `UnitsConstants` scale
  See Also:
    `UnitsConstants`

### convert

    public static FormattedNumber convert(double val,
                                          java.lang.String units)

### convert

    public static FormattedNumber convert(double val,
                                          java.lang.String units,
                                          java.util.Locale locale)

  Convert the value into a string based on the specified units.

  Parameters:
    `val` - Value to render
    `units` - One of MeasurementConstants.UNITS_*
    `locale` - The locale to use when rendering the result
  Returns:
    a formattedNumber representing the approximated value

### convert

    public static FormattedNumber convert(double val,
                                          java.lang.String units,
                                          FormatSpecifics specifics)

  Convert the value into a string based on the specified units.

  Parameters:
    `val` - Value to render
    `units` - One of MeasurementConstants.UNITS_*
    `specifics` - config object for formatting specifics
  Returns:
    a formattedNumber representing the approximated value

### convert

    public static FormattedNumber convert(double val,
                                          java.lang.String units,
                                          java.util.Locale locale,
                                          FormatSpecifics specifics)

  Convert the value into a string based on the specified units.

  Parameters:
    `val` - Value to render
    `units` - One of MeasurementConstants.UNITS_*
    `locale` - The locale to use when rendering the result
    `specifics` - config object for formatting specifics
  Returns:
    a formattedNumber representing the approximated value

### convertSame

    public static FormattedNumber[] convertSame(double[] vals,
                                                java.lang.String units,
                                                java.util.Locale locale)

  Format multiple values into approximated values, all of which use the same unit. Example: If 1, 100, 1000, 10000 are the values passed and the units == UNITS_BYTES, the following is returned 1 B, 100B, 1000B, 10000B Notice that the bytes on 1000) did not change to KB

  Parameters:
    `vals` - Values to render
    `units` - One of MeasurementConstants.UNITS_*
    `locale` - The locale to use when rendering the result
  Returns:
    An array of FormattedNumber[] objects which represent the formatted value for each corresponding value in 'vals'

### convertSame

    public static FormattedNumber[] convertSame(double[] vals,
                                                java.lang.String units,
                                                java.util.Locale locale,
                                                FormatSpecifics specifics)

### main

    public static void main(java.lang.String[] args)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Hyperic HQ Plugin API v. 4.4.0.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.