java.lang.Object | |||
↳ | org.joda.time.base.AbstractInterval | ||
↳ | org.joda.time.base.BaseInterval | ||
↳ | org.joda.time.MutableInterval |
MutableInterval is the standard implementation of a mutable time interval.
A time interval represents a period of time between two instants. Intervals are inclusive of the start instant and exclusive of the end. The end instant is always greater than or equal to the start instant.
Intervals have a fixed millisecond duration.
This is the difference between the start and end instants.
The duration is represented separately by ReadableDuration
.
As a result, intervals are not comparable.
To compare the length of two intervals, you should compare their durations.
An interval can also be converted to a ReadablePeriod
.
This represents the difference between the start and end points in terms of fields
such as years and days.
If performing significant calculations on an interval, it may be faster to convert an Interval object to a MutableInterval one.
MutableInterval is mutable and not thread-safe, unless concurrent threads are not invoking mutator methods.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a zero length time interval from 1970-01-01 to 1970-01-01.
| |||||||||||
Constructs an interval from a start and end instant with the ISO default chronology.
| |||||||||||
Constructs an interval from a start and end instant with a chronology.
| |||||||||||
Constructs an interval from a start and end instant.
| |||||||||||
Constructs an interval from a start instant and a duration.
| |||||||||||
Constructs an interval from a millisecond duration and an end instant.
| |||||||||||
Constructs an interval from a start instant and a time period.
| |||||||||||
Constructs an interval from a time period and an end instant.
| |||||||||||
Constructs a time interval by converting or copying from another object.
| |||||||||||
Constructs a time interval by converting or copying from another object,
overriding the chronology.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Clone this object.
| |||||||||||
Clone this object without having to cast the returned object.
| |||||||||||
Sets the chronology of this time interval.
| |||||||||||
Sets the duration of this time interval, preserving the start instant.
| |||||||||||
Sets the duration of this time interval, preserving the start instant.
| |||||||||||
Sets the duration of this time interval, preserving the end instant.
| |||||||||||
Sets the duration of this time interval, preserving the end instant.
| |||||||||||
Sets the end of this time interval as an Instant.
| |||||||||||
Sets the end of this time interval.
| |||||||||||
Sets this interval from two instants, replacing the chronology with
that from the start instant.
| |||||||||||
Sets this interval from two millisecond instants retaining the chronology.
| |||||||||||
Sets this interval to be the same as another.
| |||||||||||
Sets the period of this time interval, preserving the start instant
and using the ISOChronology in the default zone for calculations.
| |||||||||||
Sets the period of this time interval, preserving the end instant
and using the ISOChronology in the default zone for calculations.
| |||||||||||
Sets the start of this time interval as an Instant.
| |||||||||||
Sets the start of this time interval.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.joda.time.base.BaseInterval
| |||||||||||
From class
org.joda.time.base.AbstractInterval
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.joda.time.ReadWritableInterval
| |||||||||||
From interface
org.joda.time.ReadableInterval
|
Constructs a zero length time interval from 1970-01-01 to 1970-01-01.
Constructs an interval from a start and end instant with the ISO default chronology.
startInstant | start of this interval, as milliseconds from 1970-01-01T00:00:00Z. |
---|---|
endInstant | end of this interval, as milliseconds from 1970-01-01T00:00:00Z. |
IllegalArgumentException | if the end is before the start |
---|
Constructs an interval from a start and end instant with a chronology.
startInstant | start of this interval, as milliseconds from 1970-01-01T00:00:00Z. |
---|---|
endInstant | end of this interval, as milliseconds from 1970-01-01T00:00:00Z. |
chronology | the chronology to use, null is ISO default |
IllegalArgumentException | if the end is before the start |
---|
Constructs an interval from a start and end instant.
The chronology used is that of the start instant.
start | start of this interval, null means now |
---|---|
end | end of this interval, null means now |
IllegalArgumentException | if the end is before the start |
---|
Constructs an interval from a start instant and a duration.
start | start of this interval, null means now |
---|---|
duration | the duration of this interval, null means zero length |
IllegalArgumentException | if the end is before the start |
---|---|
ArithmeticException | if the end instant exceeds the capacity of a long |
Constructs an interval from a millisecond duration and an end instant.
duration | the duration of this interval, null means zero length |
---|---|
end | end of this interval, null means now |
IllegalArgumentException | if the end is before the start |
---|---|
ArithmeticException | if the start instant exceeds the capacity of a long |
Constructs an interval from a start instant and a time period.
When forming the interval, the chronology from the instant is used if present, otherwise the chronology of the period is used.
start | start of this interval, null means now |
---|---|
period | the period of this interval, null means zero length |
IllegalArgumentException | if the end is before the start |
---|---|
ArithmeticException | if the end instant exceeds the capacity of a long |
Constructs an interval from a time period and an end instant.
When forming the interval, the chronology from the instant is used if present, otherwise the chronology of the period is used.
period | the period of this interval, null means zero length |
---|---|
end | end of this interval, null means now |
IllegalArgumentException | if the end is before the start |
---|---|
ArithmeticException | if the start instant exceeds the capacity of a long |
Constructs a time interval by converting or copying from another object.
The recognised object types are defined in
ConverterManager
and
include ReadableInterval and String.
The String formats are described by dateTimeParser()
and standard()
, and may be 'datetime/datetime',
'datetime/period' or 'period/datetime'.
interval | the time interval to copy |
---|
IllegalArgumentException | if the interval is invalid |
---|
Constructs a time interval by converting or copying from another object, overriding the chronology.
The recognised object types are defined in
ConverterManager
and
include ReadableInterval and String.
The String formats are described by dateTimeParser()
and standard()
, and may be 'datetime/datetime',
'datetime/period' or 'period/datetime'.
interval | the time interval to copy |
---|---|
chronology | the chronology to use, null means ISO default |
IllegalArgumentException | if the interval is invalid |
---|
Clone this object without having to cast the returned object.
Sets the chronology of this time interval.
chrono | the chronology to use, null means ISO default |
---|
Sets the duration of this time interval, preserving the start instant.
duration | new duration for interval, null means zero length |
---|
IllegalArgumentException | if the end is before the start |
---|---|
ArithmeticException | if the end instant exceeds the capacity of a long |
Sets the duration of this time interval, preserving the start instant.
duration | new duration for interval |
---|
IllegalArgumentException | if the end is before the start |
---|---|
ArithmeticException | if the end instant exceeds the capacity of a long |
Sets the duration of this time interval, preserving the end instant.
duration | new duration for interval |
---|
IllegalArgumentException | if the end is before the start |
---|---|
ArithmeticException | if the start instant exceeds the capacity of a long |
Sets the duration of this time interval, preserving the end instant.
duration | new duration for interval, null means zero length |
---|
IllegalArgumentException | if the end is before the start |
---|---|
ArithmeticException | if the start instant exceeds the capacity of a long |
Sets the end of this time interval as an Instant.
end | the end of the time interval, null means now |
---|
IllegalArgumentException | if the end is before the start |
---|
Sets the end of this time interval.
endInstant | the end of the time interval, millisecond instant from 1970-01-01T00:00:00Z |
---|
IllegalArgumentException | if the end is before the start |
---|
Sets this interval from two instants, replacing the chronology with that from the start instant.
start | the start of the time interval |
---|---|
end | the start of the time interval |
IllegalArgumentException | if the end is before the start |
---|
Sets this interval from two millisecond instants retaining the chronology.
startInstant | the start of the time interval |
---|---|
endInstant | the start of the time interval |
IllegalArgumentException | if the end is before the start |
---|
Sets this interval to be the same as another.
interval | the interval to copy |
---|
IllegalArgumentException | if the interval is null |
---|
Sets the period of this time interval, preserving the start instant and using the ISOChronology in the default zone for calculations.
period | new period for interval, null means zero length |
---|
IllegalArgumentException | if the end is before the start |
---|---|
ArithmeticException | if the end instant exceeds the capacity of a long |
Sets the period of this time interval, preserving the end instant and using the ISOChronology in the default zone for calculations.
period | new period for interval, null means zero length |
---|
IllegalArgumentException | if the end is before the start |
---|---|
ArithmeticException | if the start instant exceeds the capacity of a long |
Sets the start of this time interval as an Instant.
start | the start of the time interval, null means now |
---|
IllegalArgumentException | if the end is before the start |
---|
Sets the start of this time interval.
startInstant | the start of the time interval, millisecond instant from 1970-01-01T00:00:00Z |
---|
IllegalArgumentException | if the end is before the start |
---|