Package org.ocpsoft.prettytime.format
Class SimpleTimeFormat
java.lang.Object
org.ocpsoft.prettytime.format.SimpleTimeFormat
- All Implemented Interfaces:
LocaleAware<SimpleTimeFormat>,TimeFormat
- Direct Known Subclasses:
ResourcesTimeFormat
Represents a simple method of formatting a specific
Duration of time- Author:
- Lincoln Baxter, III
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDecorate with past or future prefix/suffix (with rounding)decorateUnrounded(Duration duration, String time) Decorate with past or future prefix/suffix (without rounding)Given a populatedDurationobject.formatUnrounded(Duration duration) Given a populatedDurationobject.protected StringgetGramaticallyCorrectName(Duration d, boolean round) protected StringgetPattern(long quantity) protected longgetQuantity(Duration duration, boolean round) protected booleansetFuturePluralName(String futurePluralName) setFuturePrefix(String futurePrefix) setFutureSingularName(String futureSingularName) setFutureSuffix(String futureSuffix) Set theLocalefor which this instance should behave in.setPastPluralName(String pastPluralName) setPastPrefix(String pastPrefix) setPastSingularName(String pastSingularName) setPastSuffix(String pastSuffix) setPattern(String pattern) setPluralName(String pluralName) setRoundingTolerance(int roundingTolerance) The percentage of the currentTimeUnit.getMillisPerUnit() for which the quantity may be rounded up by one.setSingularName(String name) toString()
-
Field Details
-
SIGN
- See Also:
-
QUANTITY
- See Also:
-
UNIT
- See Also:
-
-
Constructor Details
-
SimpleTimeFormat
public SimpleTimeFormat()
-
-
Method Details
-
setLocale
Description copied from interface:LocaleAwareSet theLocalefor which this instance should behave in.- Specified by:
setLocalein interfaceLocaleAware<SimpleTimeFormat>
-
format
Description copied from interface:TimeFormatGiven a populatedDurationobject. Apply formatting (with rounding) and output the result.- Specified by:
formatin interfaceTimeFormat
-
formatUnrounded
Description copied from interface:TimeFormatGiven a populatedDurationobject. Apply formatting (without rounding) and output the result.- Specified by:
formatUnroundedin interfaceTimeFormat
-
decorate
Description copied from interface:TimeFormatDecorate with past or future prefix/suffix (with rounding)- Specified by:
decoratein interfaceTimeFormat- Parameters:
duration- The originalDurationinstance from which the time string should be decorated.time- The formatted time string.
-
decorateUnrounded
Description copied from interface:TimeFormatDecorate with past or future prefix/suffix (without rounding)- Specified by:
decorateUnroundedin interfaceTimeFormat- Parameters:
duration- The originalDurationinstance from which the time string should be decorated.time- The formatted time string.
-
getPattern
-
getPattern
-
getQuantity
-
getGramaticallyCorrectName
-
isPlural
-
setPattern
-
setFuturePrefix
-
setFutureSuffix
-
setPastPrefix
-
setPastSuffix
-
setRoundingTolerance
The percentage of the currentTimeUnit.getMillisPerUnit() for which the quantity may be rounded up by one. -
setSingularName
-
setPluralName
-
setFutureSingularName
-
setFuturePluralName
-
setPastSingularName
-
setPastPluralName
-
toString
-