Class/Object

scala.concurrent.duration

FiniteDuration

Related Docs: object FiniteDuration | package duration

Permalink

final class FiniteDuration extends Duration

This class represents a finite duration. Its addition and subtraction operators are overloaded to retain this guarantee statically. The range of this class is limited to +-(2^63-1)ns, which is roughly 292 years.

Linear Supertypes
Duration, math.Ordered[Duration], Comparable[Duration], Serializable, java.io.Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. FiniteDuration
  2. Duration
  3. Ordered
  4. Comparable
  5. Serializable
  6. Serializable
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new FiniteDuration(length: Long, unit: TimeUnit)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def *(factor: Long): FiniteDuration

    Permalink

    Return the product of this duration and the given integer factor.

    Return the product of this duration and the given integer factor.

    Exceptions thrown

    IllegalArgumentException if the result would overflow the range of FiniteDuration

  4. def *(factor: Double): Duration

    Permalink

    Return this duration multiplied by the scalar factor.

    Return this duration multiplied by the scalar factor. When involving non-finite factors the semantics match those of Double.

    Definition Classes
    FiniteDurationDuration
    Exceptions thrown

    IllegalArgumentException in case of a finite overflow: the range of a finite duration is +-(2^63-1)ns, and no conversion to infinite durations takes place.

  5. def +(other: FiniteDuration): FiniteDuration

    Permalink
  6. def +(other: Duration): Duration

    Permalink

    Return the sum of that duration and this.

    Return the sum of that duration and this. When involving non-finite summands the semantics match those of Double.

    Definition Classes
    FiniteDurationDuration
    Exceptions thrown

    IllegalArgumentException in case of a finite overflow: the range of a finite duration is +-(2^63-1)ns, and no conversion to infinite durations takes place.

  7. def -(other: FiniteDuration): FiniteDuration

    Permalink
  8. def -(other: Duration): Duration

    Permalink

    Return the difference of that duration and this.

    Return the difference of that duration and this. When involving non-finite summands the semantics match those of Double.

    Definition Classes
    FiniteDurationDuration
    Exceptions thrown

    IllegalArgumentException in case of a finite overflow: the range of a finite duration is +-(2^63-1)ns, and no conversion to infinite durations takes place.

  9. def /(divisor: Long): FiniteDuration

    Permalink

    Return the quotient of this duration and the given integer factor.

    Return the quotient of this duration and the given integer factor.

    Exceptions thrown

    ArithmeticException if the factor is 0

  10. def /(divisor: Duration): Double

    Permalink

    Return the quotient of this and that duration as floating-point number.

    Return the quotient of this and that duration as floating-point number. The semantics are determined by Double as if calculating the quotient of the nanosecond lengths of both factors.

    Definition Classes
    FiniteDurationDuration
  11. def /(divisor: Double): Duration

    Permalink

    Return this duration divided by the scalar factor.

    Return this duration divided by the scalar factor. When involving non-finite factors the semantics match those of Double.

    Definition Classes
    FiniteDurationDuration
    Exceptions thrown

    IllegalArgumentException in case of a finite overflow: the range of a finite duration is +-(2^63-1)ns, and no conversion to infinite durations takes place.

  12. def <(that: Duration): Boolean

    Permalink

    Returns true if this is less than that

    Returns true if this is less than that

    Definition Classes
    Ordered
  13. def <=(that: Duration): Boolean

    Permalink

    Returns true if this is less than or equal to that.

    Returns true if this is less than or equal to that.

    Definition Classes
    Ordered
  14. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  15. def >(that: Duration): Boolean

    Permalink

    Returns true if this is greater than that.

    Returns true if this is greater than that.

    Definition Classes
    Ordered
  16. def >=(that: Duration): Boolean

    Permalink

    Returns true if this is greater than or equal to that.

    Returns true if this is greater than or equal to that.

    Definition Classes
    Ordered
  17. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  18. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. def compare(other: Duration): Int

    Permalink

    Result of comparing this with operand that.

    Result of comparing this with operand that.

    Implement this method to determine how instances of A will be sorted.

    Returns x where:

    • x < 0 when this < that
    • x == 0 when this == that
    • x > 0 when this > that
    Definition Classes
    FiniteDurationOrdered
  20. def compareTo(that: Duration): Int

    Permalink

    Result of comparing this with operand that.

    Result of comparing this with operand that.

    Definition Classes
    Ordered → Comparable
  21. def div(divisor: Long): FiniteDuration

    Permalink

    Return the quotient of this duration and the given integer factor.

    Return the quotient of this duration and the given integer factor.

    Exceptions thrown

    ArithmeticException if the factor is 0

  22. def div(other: Duration): Double

    Permalink

    Return the quotient of this and that duration as floating-point number.

    Return the quotient of this and that duration as floating-point number. The semantics are determined by Double as if calculating the quotient of the nanosecond lengths of both factors.

    Definition Classes
    Duration
  23. def div(divisor: Double): Duration

    Permalink

    Return this duration divided by the scalar factor.

    Return this duration divided by the scalar factor. When involving non-finite factors the semantics match those of Double.

    Definition Classes
    Duration
    Exceptions thrown

    IllegalArgumentException in case of a finite overflow: the range of a finite duration is +-(2^63-1)ns, and no conversion to infinite durations takes place.

  24. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  25. def equals(other: Any): Boolean

    Permalink
    Definition Classes
    FiniteDuration → AnyRef → Any
  26. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  27. def fromNow: Deadline

    Permalink

    Construct a Deadline from this duration by adding it to the current instant Deadline.now.

  28. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  29. def gt(other: Duration): Boolean

    Permalink
    Definition Classes
    Duration
  30. def gteq(other: Duration): Boolean

    Permalink
    Definition Classes
    Duration
  31. def hashCode(): Int

    Permalink
    Definition Classes
    FiniteDuration → AnyRef → Any
  32. final def isFinite(): Boolean

    Permalink

    This method returns whether this duration is finite, which is not the same as !isInfinite for Double because this method also returns false for Duration.Undefined.

    This method returns whether this duration is finite, which is not the same as !isInfinite for Double because this method also returns false for Duration.Undefined.

    Definition Classes
    FiniteDurationDuration
  33. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  34. val length: Long

    Permalink

    Obtain the length of this Duration measured in the unit obtained by the unit method.

    Obtain the length of this Duration measured in the unit obtained by the unit method.

    Definition Classes
    FiniteDurationDuration
    Exceptions thrown

    IllegalArgumentException when invoked on a non-finite duration

  35. def lt(other: Duration): Boolean

    Permalink
    Definition Classes
    Duration
  36. def lteq(other: Duration): Boolean

    Permalink
    Definition Classes
    Duration
  37. def max(other: FiniteDuration): FiniteDuration

    Permalink
  38. def max(other: Duration): Duration

    Permalink

    Return the larger of this and that duration as determined by the natural ordering.

    Return the larger of this and that duration as determined by the natural ordering.

    Definition Classes
    Duration
  39. def min(other: FiniteDuration): FiniteDuration

    Permalink
  40. def min(other: Duration): Duration

    Permalink

    Return the smaller of this and that duration as determined by the natural ordering.

    Return the smaller of this and that duration as determined by the natural ordering.

    Definition Classes
    Duration
  41. def minus(other: FiniteDuration): FiniteDuration

    Permalink
  42. def minus(other: Duration): Duration

    Permalink

    Return the difference of that duration and this.

    Return the difference of that duration and this. When involving non-finite summands the semantics match those of Double.

    Definition Classes
    Duration
    Exceptions thrown

    IllegalArgumentException in case of a finite overflow: the range of a finite duration is +-(2^63-1)ns, and no conversion to infinite durations takes place.

  43. def mul(factor: Long): FiniteDuration

    Permalink

    Return the product of this duration and the given integer factor.

    Return the product of this duration and the given integer factor.

    Exceptions thrown

    IllegalArgumentException if the result would overflow the range of FiniteDuration

  44. def mul(factor: Double): Duration

    Permalink

    Return this duration multiplied by the scalar factor.

    Return this duration multiplied by the scalar factor. When involving non-finite factors the semantics match those of Double.

    Definition Classes
    Duration
    Exceptions thrown

    IllegalArgumentException in case of a finite overflow: the range of a finite duration is +-(2^63-1)ns, and no conversion to infinite durations takes place.

  45. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  46. def neg(): Duration

    Permalink

    Negate this duration.

    Negate this duration. The only two values which are mapped to themselves are Duration.Zero and Duration.Undefined.

    Definition Classes
    Duration
  47. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  48. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  49. def plus(other: FiniteDuration): FiniteDuration

    Permalink
  50. def plus(other: Duration): Duration

    Permalink

    Return the sum of that duration and this.

    Return the sum of that duration and this. When involving non-finite summands the semantics match those of Double.

    Definition Classes
    Duration
    Exceptions thrown

    IllegalArgumentException in case of a finite overflow: the range of a finite duration is +-(2^63-1)ns, and no conversion to infinite durations takes place.

  51. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  52. final def toCoarsest: Duration

    Permalink

    Return duration which is equal to this duration but with a coarsest Unit, or self in case it is already the coarsest Unit

    Return duration which is equal to this duration but with a coarsest Unit, or self in case it is already the coarsest Unit

    Examples:

    Duration(60, MINUTES).toCoarsest // Duration(1, HOURS)
    Duration(1000, MILLISECONDS).toCoarsest // Duration(1, SECONDS)
    Duration(48, HOURS).toCoarsest // Duration(2, DAYS)
    Duration(5, SECONDS).toCoarsest // Duration(5, SECONDS)
    Definition Classes
    FiniteDurationDuration
  53. def toDays: Long

    Permalink

    Return the length of this duration measured in whole days, rounding towards zero.

    Return the length of this duration measured in whole days, rounding towards zero.

    Definition Classes
    FiniteDurationDuration
    Exceptions thrown

    IllegalArgumentException when invoked on a non-finite duration

  54. def toHours: Long

    Permalink

    Return the length of this duration measured in whole hours, rounding towards zero.

    Return the length of this duration measured in whole hours, rounding towards zero.

    Definition Classes
    FiniteDurationDuration
    Exceptions thrown

    IllegalArgumentException when invoked on a non-finite duration

  55. def toMicros: Long

    Permalink

    Return the length of this duration measured in whole microseconds, rounding towards zero.

    Return the length of this duration measured in whole microseconds, rounding towards zero.

    Definition Classes
    FiniteDurationDuration
    Exceptions thrown

    IllegalArgumentException when invoked on a non-finite duration

  56. def toMillis: Long

    Permalink

    Return the length of this duration measured in whole milliseconds, rounding towards zero.

    Return the length of this duration measured in whole milliseconds, rounding towards zero.

    Definition Classes
    FiniteDurationDuration
    Exceptions thrown

    IllegalArgumentException when invoked on a non-finite duration

  57. def toMinutes: Long

    Permalink

    Return the length of this duration measured in whole minutes, rounding towards zero.

    Return the length of this duration measured in whole minutes, rounding towards zero.

    Definition Classes
    FiniteDurationDuration
    Exceptions thrown

    IllegalArgumentException when invoked on a non-finite duration

  58. def toNanos: Long

    Permalink

    Return the length of this duration measured in whole nanoseconds, rounding towards zero.

    Return the length of this duration measured in whole nanoseconds, rounding towards zero.

    Definition Classes
    FiniteDurationDuration
    Exceptions thrown

    IllegalArgumentException when invoked on a non-finite duration

  59. def toSeconds: Long

    Permalink

    Return the length of this duration measured in whole seconds, rounding towards zero.

    Return the length of this duration measured in whole seconds, rounding towards zero.

    Definition Classes
    FiniteDurationDuration
    Exceptions thrown

    IllegalArgumentException when invoked on a non-finite duration

  60. def toString(): String

    Permalink
    Definition Classes
    FiniteDuration → AnyRef → Any
  61. def toUnit(u: TimeUnit): Double

    Permalink

    Return the number of nanoseconds as floating point number, scaled down to the given unit.

    Return the number of nanoseconds as floating point number, scaled down to the given unit. The result may not precisely represent this duration due to the Double datatype's inherent limitations (mantissa size effectively 53 bits). Non-finite durations are represented as

    Definition Classes
    FiniteDurationDuration
  62. def unary_-: FiniteDuration

    Permalink

    Negate this duration.

    Negate this duration. The only two values which are mapped to themselves are Duration.Zero and Duration.Undefined.

    Definition Classes
    FiniteDurationDuration
  63. val unit: TimeUnit

    Permalink

    Obtain the time unit in which the length of this duration is measured.

    Obtain the time unit in which the length of this duration is measured.

    Definition Classes
    FiniteDurationDuration
    Exceptions thrown

    IllegalArgumentException when invoked on a non-finite duration

  64. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  65. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  66. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Duration

Inherited from math.Ordered[Duration]

Inherited from Comparable[Duration]

Inherited from Serializable

Inherited from java.io.Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped