Package org.ocpsoft.prettytime.impl
Class DurationImpl
java.lang.Object
org.ocpsoft.prettytime.impl.DurationImpl
- All Implemented Interfaces:
Duration
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanlonggetDelta()Return the number of milliseconds left over when calculating the number ofTimeUnit's that fit into the given time range.longReturn the calculated quantity ofTimeUnitinstances.longgetQuantityRounded(int tolerance) Return the calculated quantity ofTimeUnitinstances, rounded up ifDuration.getDelta()is greater than or equal to the given tolerance.getUnit()inthashCode()booleanbooleanisInPast()voidsetDelta(long delta) voidsetQuantity(long quantity) voidtoString()
-
Constructor Details
-
DurationImpl
public DurationImpl()
-
-
Method Details
-
getQuantity
public long getQuantity()Description copied from interface:DurationReturn the calculated quantity ofTimeUnitinstances.- Specified by:
getQuantityin interfaceDuration
-
setQuantity
public void setQuantity(long quantity) -
getUnit
Description copied from interface:Duration -
setUnit
-
getDelta
public long getDelta()Description copied from interface:DurationReturn the number of milliseconds left over when calculating the number ofTimeUnit's that fit into the given time range. -
setDelta
public void setDelta(long delta) -
isInPast
public boolean isInPast()Description copied from interface:Duration -
isInFuture
public boolean isInFuture()Description copied from interface:Duration- Specified by:
isInFuturein interfaceDuration
-
getQuantityRounded
public long getQuantityRounded(int tolerance) Description copied from interface:DurationReturn the calculated quantity ofTimeUnitinstances, rounded up ifDuration.getDelta()is greater than or equal to the given tolerance.- Specified by:
getQuantityRoundedin interfaceDuration
-
toString
-
hashCode
public int hashCode() -
equals
-