|
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 |
java.lang.Objectorg.hyperic.util.units.DurationFormatter
public class DurationFormatter
Format a value into a duration.
Field Summary | |
---|---|
protected static int |
GRANULAR_DAYS
|
protected static int |
GRANULAR_HOURS
|
protected static int |
GRANULAR_MILLIS
|
protected static int |
GRANULAR_MINS
|
protected static int |
GRANULAR_SECS
|
protected static int |
GRANULAR_YEARS
|
protected static int |
MILLISEC_DIGITS
|
Constructor Summary | |
---|---|
DurationFormatter()
|
Method Summary | |
---|---|
protected org.hyperic.util.units.DurationFormatter.TimeBreakDown |
breakDownTime(java.math.BigDecimal val)
|
protected FormattedNumber |
format(java.math.BigDecimal baseTime,
int granularity,
int milliDigits,
java.util.Locale locale)
|
FormattedNumber |
format(UnitNumber val,
java.util.Locale locale,
FormatSpecifics specifics)
Format a number with the given locale. |
FormattedNumber[] |
formatSame(double[] val,
int unitType,
int scale,
java.util.Locale locale,
FormatSpecifics specifics)
Format a several values at once into the same format. |
java.math.BigDecimal |
getBaseValue(double value,
int scale)
Get the base value of a value, given its scale. |
java.math.BigDecimal |
getScaledValue(java.math.BigDecimal value,
int targScale)
Get a scaled version of a value. |
UnitNumber |
parse(java.lang.String val,
java.util.Locale locale,
ParseSpecifics specifics)
Parse a string into a UnitNumber. |
protected double |
parseTimeStr(java.lang.String duration)
Returns the # of seconds in a string in the form of "xx.xs" or "xx:yy:zz.a" |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int GRANULAR_YEARS
protected static final int GRANULAR_DAYS
protected static final int GRANULAR_HOURS
protected static final int GRANULAR_MINS
protected static final int GRANULAR_SECS
protected static final int GRANULAR_MILLIS
protected static final int MILLISEC_DIGITS
Constructor Detail |
---|
public DurationFormatter()
Method Detail |
---|
public FormattedNumber format(UnitNumber val, java.util.Locale locale, FormatSpecifics specifics)
Formatter
format
in interface Formatter
val
- Value to formatlocale
- Locale that the resultant format should be inspecifics
- Optional format to give specific hints to the
formatter about how the result should look.public FormattedNumber[] formatSame(double[] val, int unitType, int scale, java.util.Locale locale, FormatSpecifics specifics)
Formatter
formatSame
in interface Formatter
val
- 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.protected FormattedNumber format(java.math.BigDecimal baseTime, int granularity, int milliDigits, java.util.Locale locale)
protected org.hyperic.util.units.DurationFormatter.TimeBreakDown breakDownTime(java.math.BigDecimal val)
public java.math.BigDecimal getBaseValue(double value, int scale)
Formatter
getBaseValue
in interface Formatter
value
- Value to get the base ofscale
- Scale of the value -- must be valid for the
formatter unit typepublic java.math.BigDecimal getScaledValue(java.math.BigDecimal value, int targScale)
Formatter
getScaledValue
in interface Formatter
value
- Value to scaletargScale
- Target scale -- must be valid for the
formatter unit typeprotected double parseTimeStr(java.lang.String duration) throws java.text.ParseException
java.text.ParseException
public UnitNumber parse(java.lang.String val, java.util.Locale locale, ParseSpecifics specifics) throws java.text.ParseException
Formatter
parse
in interface Formatter
val
- Value to parselocale
- Locale to parse withspecifics
- An optional argument which gives the parser
more information about parsing
java.text.ParseException
|
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 |