org.hyperic.util.units
Class PercentageFormatter
java.lang.Object
org.hyperic.util.units.SimpleFormatter
org.hyperic.util.units.PercentageFormatter
- All Implemented Interfaces:
- Formatter
- Direct Known Subclasses:
- PercentFormatter
public class PercentageFormatter
- extends SimpleFormatter
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PercentageFormatter
public PercentageFormatter()
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 parselocale
- Locale to parse withspecifics
- 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 formatunitType
- One of UnitsConstants.UNIT_*scale
- One of UnitsConstants.SCALE_*locale
- Locale that the resultant format should be inspecifics
- Optional format to give specific hints to the
formatter about how the result should look.
Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.