Class DurationImpl

java.lang.Object
org.ocpsoft.prettytime.impl.DurationImpl
All Implemented Interfaces:
Duration

public class DurationImpl extends Object implements Duration
  • Constructor Details

    • DurationImpl

      public DurationImpl()
  • Method Details

    • getQuantity

      public long getQuantity()
      Description copied from interface: Duration
      Return the calculated quantity of TimeUnit instances.
      Specified by:
      getQuantity in interface Duration
    • setQuantity

      public void setQuantity(long quantity)
    • getUnit

      public TimeUnit getUnit()
      Description copied from interface: Duration
      Return the TimeUnit represented by this Duration
      Specified by:
      getUnit in interface Duration
    • setUnit

      public void setUnit(TimeUnit unit)
    • getDelta

      public long getDelta()
      Description copied from interface: Duration
      Return the number of milliseconds left over when calculating the number of TimeUnit's that fit into the given time range.
      Specified by:
      getDelta in interface Duration
    • setDelta

      public void setDelta(long delta)
    • isInPast

      public boolean isInPast()
      Description copied from interface: Duration
      Return true if this Duration represents a number of TimeUnit instances in the past.
      Specified by:
      isInPast in interface Duration
    • isInFuture

      public boolean isInFuture()
      Description copied from interface: Duration
      Return true if this Duration represents a number of TimeUnit instances in the future.
      Specified by:
      isInFuture in interface Duration
    • getQuantityRounded

      public long getQuantityRounded(int tolerance)
      Description copied from interface: Duration
      Return the calculated quantity of TimeUnit instances, rounded up if Duration.getDelta() is greater than or equal to the given tolerance.
      Specified by:
      getQuantityRounded in interface Duration
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object