This class is immutable and thread-safe.
Operations that add or subtract durations to a Deadline, whether
represented as a Duration or as a long time increment (such
as seconds or nanoseconds) do not throw on numeric overflow if the resulting
Deadline would exceed MAX or be less than MIN.
Instead, MAX or MIN is returned, respectively. Similarly,
methods that return a duration as a long will either return
Long#MAX_VALUE or Long#MIN_VALUE if the returned quantity
would exceed the capacity of a long.
| Modifier and Type | Field and Description |
|---|---|
| private final Instant | |
| public static final Deadline | |
| public static final Deadline |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv Instant | |
| public static Duration | |
| public int | compareTo(Deadline o)
Implements java. Compares this object with the specified object for order. |
| public boolean | equals(Object o)
Overrides java. Indicates whether some other object is "equal to" this one. |
| public int | |
| public boolean | |
| public boolean | |
| public Deadline | |
| pack-priv static Deadline | |
| public Deadline | Returns: a deadline with the specified amount added to this deadlinethe amount of the unit to add to the result, may be negative amountToAdd, TemporalUnit the unit of the amount to add, not null unit)Returns a deadline with the specified amount added to this deadline. |
| public Deadline | |
| public Deadline | Returns: a deadline with the specified duration in milliseconds added to this deadlinethe milliseconds to add, positive or negative millisToAdd)Returns a deadline with the specified duration in milliseconds added to this deadline. |
| public Deadline | Returns: a deadline with the specified duration in nanoseconds addedthe nanoseconds to add, positive or negative nanosToAdd)Returns a deadline with the specified duration in nanoseconds added. |
| public Deadline | Returns: a deadline with the specified duration in seconds added to this deadlinethe seconds to add, positive or negative secondsToAdd)Returns a deadline with the specified duration in seconds added to this deadline. |
| public String | |
| public Deadline | Returns: aDeadline based on this deadline with the time truncated, not nullthe unit to truncate to, not null unit)Returns a copy of this |
| public long | Returns: the amount of time between this deadline and the end deadlinethe end deadline, exclusive endExclusive, TemporalUnit the unit to measure the amount in, not null unit)Calculates the amount of time until another deadline in terms of the specified unit. |
| deadline | back to summary |
|---|---|
| private final Instant deadline | |
| MAX | back to summary |
|---|---|
| public static final Deadline MAX | |
| MIN | back to summary |
|---|---|
| public static final Deadline MIN | |
| Deadline | back to summary |
|---|---|
| private Deadline(Instant deadline) | |
| asInstant | back to summary |
|---|---|
| pack-priv Instant asInstant() | |
| between | back to summary |
|---|---|
| public static Duration between(Deadline startInclusive, Deadline endExclusive) Obtains a The result of this method can be a negative period if the end is before the start. | |
| compareTo | back to summary |
|---|---|
| public int compareTo(Deadline o) Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isAfter | back to summary |
|---|---|
| public boolean isAfter(Deadline otherDeadline) Checks if this deadline is after the specified deadline. The comparison is based on the time-line position of the deadlines.
| |
| isBefore | back to summary |
|---|---|
| public boolean isBefore(Deadline otherDeadline) Checks if this deadline is before the specified deadline. The comparison is based on the time-line position of the deadlines.
| |
| minus | back to summary |
|---|---|
| public Deadline minus(Duration duration) Returns a deadline with the specified amount subtracted from this deadline. This instance is immutable and unaffected by this method call.
On numeric overflows, this method will return
| |
| of | back to summary |
|---|---|
| pack-priv static Deadline of(Instant instant) | |
| plus | back to summary |
|---|---|
| public Deadline plus(long amountToAdd, TemporalUnit unit) Returns a deadline with the specified amount added to this deadline.
This returns a This instance is immutable and unaffected by this method call.
On numeric overflows, this method will return
| |
| plus | back to summary |
|---|---|
| public Deadline plus(Duration duration) Returns a deadline with the specified duration added to this deadline. This instance is immutable and unaffected by this method call.
On numeric overflows, this method will return
| |
| plusMillis | back to summary |
|---|---|
| public Deadline plusMillis(long millisToAdd) Returns a deadline with the specified duration in milliseconds added to this deadline. This instance is immutable and unaffected by this method call.
On numeric overflows, this method will return
| |
| plusNanos | back to summary |
|---|---|
| public Deadline plusNanos(long nanosToAdd) Returns a deadline with the specified duration in nanoseconds added. This instance is immutable and unaffected by this method call.
On numeric overflows, this method will return
| |
| plusSeconds | back to summary |
|---|---|
| public Deadline plusSeconds(long secondsToAdd) Returns a deadline with the specified duration in seconds added to this deadline. This instance is immutable and unaffected by this method call.
On numeric overflows, this method will return
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| truncatedTo | back to summary |
|---|---|
| public Deadline truncatedTo(ChronoUnit unit) Returns a copy of this
Truncating the deadline returns a copy of the original with fields
smaller than the specified unit set to zero.
The fields are calculated on the basis of using a UTC offset as seen
in
The unit must have a duration
that divides into the length of a standard day without remainder.
This includes all supplied time units on This instance is immutable and unaffected by this method call.
| |
| until | back to summary |
|---|---|
| public long until(Deadline endExclusive, TemporalUnit unit) Calculates the amount of time until another deadline in terms of the specified unit.
This calculates the amount of time between two This instance is immutable and unaffected by this method call.
On numeric overflows, this method will return
| |