@Internal public class Deadline extends Object
now()
or from plus(Duration)
.Modifier and Type | Method and Description |
---|---|
static Deadline |
fromNow(java.time.Duration duration)
Constructs a Deadline that is a given duration after now.
|
static Deadline |
fromNowWithClock(java.time.Duration duration,
Clock clock)
Constructs a Deadline that is a given duration after now, where now and all other times from
this deadline are defined by the given
Clock . |
boolean |
hasTimeLeft()
Returns whether there is any time left between the deadline and now.
|
boolean |
isOverdue()
Determines whether the deadline is in the past, i.e.
|
static Deadline |
now()
Constructs a
Deadline that has now as the deadline. |
Deadline |
plus(java.time.Duration other) |
java.time.Duration |
timeLeft()
Returns the time left between the deadline and now.
|
java.time.Duration |
timeLeftIfAny()
Returns the time left between the deadline and now.
|
String |
toString() |
public Deadline plus(java.time.Duration other)
public java.time.Duration timeLeft()
public java.time.Duration timeLeftIfAny() throws TimeoutException
TimeoutException
will be thrown.TimeoutException
- if no time is leftpublic boolean hasTimeLeft()
public boolean isOverdue()
public static Deadline now()
Deadline
that has now as the deadline. Use this and then extend via
plus(Duration)
to specify a deadline in the future.public static Deadline fromNow(java.time.Duration duration)
public static Deadline fromNowWithClock(java.time.Duration duration, Clock clock)
Clock
.duration
- Duration for this deadline.clock
- Time provider for this deadline.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.