Package org.ocpsoft.prettytime.impl
Class ResourcesTimeUnit
java.lang.Object
org.ocpsoft.prettytime.impl.ResourcesTimeUnit
- All Implemented Interfaces:
TimeUnit
- Direct Known Subclasses:
Century,Day,Decade,Hour,JustNow,Millennium,Millisecond,Minute,Month,Second,Week,Year
- Author:
- Lincoln Baxter, III
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanlongThe maximum quantity of this Unit to be used as a threshold for the next largest Unit (e.g.longThe number of milliseconds represented by each instance of this TimeUnit.protected final StringReturn the name of the resource bundle from which this unit's format should be loaded.protected abstract StringReturn the time-unit prefix to specify which value to load from the bundle.inthashCode()booleanWhether or not thisTimeUnitrepresents a price measurement of time, or a general concept of time.voidsetMaxQuantity(long maxQuantity) voidsetMillisPerUnit(long millisPerUnit) toString()
-
Constructor Details
-
ResourcesTimeUnit
public ResourcesTimeUnit()
-
-
Method Details
-
getResourceKeyPrefix
Return the time-unit prefix to specify which value to load from the bundle. -
getResourceBundleName
Return the name of the resource bundle from which this unit's format should be loaded. -
getMaxQuantity
public long getMaxQuantity()Description copied from interface:TimeUnitThe maximum quantity of this Unit to be used as a threshold for the next largest Unit (e.g. if oneSecondrepresents 1000ms, andSecondhas a maxQuantity of 5, then if the difference between compared timestamps is larger than 5000ms, PrettyTime will move on to the next smallest TimeUnit for calculation;Minute, by default)millisPerUnit * maxQuantity = maxAllowedMs
If maxQuantity is zero, it will be equal to the next highest
TimeUnit.getMillisPerUnit() / this.getMillisPerUnit()or infinity if there are no greater TimeUnits- Specified by:
getMaxQuantityin interfaceTimeUnit
-
setMaxQuantity
public void setMaxQuantity(long maxQuantity) -
getMillisPerUnit
public long getMillisPerUnit()Description copied from interface:TimeUnitThe number of milliseconds represented by each instance of this TimeUnit. Must be a positive number greater than zero.- Specified by:
getMillisPerUnitin interfaceTimeUnit
-
setMillisPerUnit
public void setMillisPerUnit(long millisPerUnit) -
isPrecise
public boolean isPrecise()Description copied from interface:TimeUnitWhether or not thisTimeUnitrepresents a price measurement of time, or a general concept of time. E.g: "minute" as opposed to "moment". -
toString
-
hashCode
public int hashCode() -
equals
-