Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.util.units
Class PercentageFormatter

java.lang.Object
  extended by org.hyperic.util.units.SimpleFormatter
      extended by org.hyperic.util.units.PercentageFormatter
All Implemented Interfaces:
Formatter
Direct Known Subclasses:
PercentFormatter

public class PercentageFormatter
extends SimpleFormatter


Constructor Summary
PercentageFormatter()
           
 
Method Summary
protected  FormattedNumber formatNumber(double rawValue, java.text.NumberFormat fmt)
           
 FormattedNumber[] formatSame(double[] vals, int unitType, int scale, java.util.Locale locale, FormatSpecifics specifics)
          Format a several values at once into the same format.
protected  double getMultiplier()
           
protected  int getUnitScale()
           
protected  int getUnitType()
           
 UnitNumber parse(java.lang.String val, java.util.Locale locale, ParseSpecifics specifics)
          Parse a string into a UnitNumber.
 
Methods inherited from class org.hyperic.util.units.SimpleFormatter
format, getBaseValue, getNumberFormat, getScaledValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PercentageFormatter

public PercentageFormatter()
Method Detail

getUnitType

protected int getUnitType()
Specified by:
getUnitType in class SimpleFormatter

getUnitScale

protected int getUnitScale()
Specified by:
getUnitScale in class SimpleFormatter

getMultiplier

protected double getMultiplier()

formatNumber

protected FormattedNumber formatNumber(double rawValue,
                                       java.text.NumberFormat fmt)
Specified by:
formatNumber in class SimpleFormatter

parse

public UnitNumber parse(java.lang.String val,
                        java.util.Locale locale,
                        ParseSpecifics specifics)
                 throws java.text.ParseException
Description copied from interface: Formatter
Parse a string into a UnitNumber. E.x. parse("34 MB") -> UnitNumber(34, UNIT_BYTES, SCALE_MEGA)

Specified by:
parse in interface Formatter
Overrides:
parse in class SimpleFormatter
Parameters:
val - Value to parse
locale - Locale to parse with
specifics - An optional argument which gives the parser more information about parsing
Returns:
the number representing the parsed value
Throws:
java.text.ParseException

formatSame

public FormattedNumber[] formatSame(double[] vals,
                                    int unitType,
                                    int scale,
                                    java.util.Locale locale,
                                    FormatSpecifics specifics)
Description copied from interface: Formatter
Format a several values at once into the same format. I.e. no matter the discrepency of range, they all contain the same units (megabytes, etc.)

Specified by:
formatSame in interface Formatter
Overrides:
formatSame in class SimpleFormatter
Parameters:
vals - Values to format
unitType - One of UnitsConstants.UNIT_*
scale - One of UnitsConstants.SCALE_*
locale - Locale that the resultant format should be in
specifics - Optional format to give specific hints to the formatter about how the result should look.

Hyperic HQ Plugin API v. 4.4.0.2

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