org.rhq.core.clientapi.util.units
Class PercentageFormatter
java.lang.Object
org.rhq.core.clientapi.util.units.SimpleFormatter
org.rhq.core.clientapi.util.units.PercentageFormatter
- All Implemented Interfaces:
- Formatter
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 UnitsConstants getUnitType()
- Specified by:
getUnitType in class SimpleFormatter
getUnitScale
protected ScaleConstants getUnitScale()
- Specified by:
getUnitScale in class SimpleFormatter
formatNumber
protected FormattedNumber formatNumber(double rawValue,
NumberFormat fmt)
- Specified by:
formatNumber in class SimpleFormatter
parse
public UnitNumber parse(String val,
Locale locale,
ParseSpecifics specifics)
throws 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:
ParseException - if the value could not be parsed
formatSame
public FormattedNumber[] formatSame(double[] vals,
UnitsConstants unitType,
ScaleConstants scale,
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 © 2008-2009 Red Hat, Inc.. All Rights Reserved.