org.joda.time
Class MutableInterval
- Cloneable, ReadableInterval, ReadWritableInterval, Serializable
public class 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.
- Stephen Colebourne
- Brian S O'Neill
MutableInterval() - Constructs a zero length time interval from 1970-01-01 to 1970-01-01.
|
MutableInterval(Object interval) - Constructs a time interval by converting or copying from another object.
|
MutableInterval(Object interval, Chronology chronology) - Constructs a time interval by converting or copying from another object,
overriding the chronology.
|
MutableInterval(long startInstant, long endInstant) - Constructs an interval from a start and end instant with the ISO default chronology.
|
MutableInterval(long startInstant, long endInstant, Chronology chronology) - Constructs an interval from a start and end instant with a chronology.
|
MutableInterval(ReadableDuration duration, ReadableInstant end) - Constructs an interval from a millisecond duration and an end instant.
|
MutableInterval(ReadableInstant start, ReadableDuration duration) - Constructs an interval from a start instant and a duration.
|
MutableInterval(ReadableInstant start, ReadableInstant end) - Constructs an interval from a start and end instant.
|
MutableInterval(ReadableInstant start, ReadablePeriod period) - Constructs an interval from a start instant and a time period.
|
MutableInterval(ReadablePeriod period, ReadableInstant end) - Constructs an interval from a time period and an end instant.
|
checkInterval , contains , contains , contains , containsNow , equals , getEnd , getStart , hashCode , isAfter , isAfter , isAfter , isAfterNow , isBefore , isBefore , isBefore , isBeforeNow , overlaps , toDuration , toDurationMillis , toInterval , toMutableInterval , toPeriod , toPeriod , toString |
MutableInterval
public MutableInterval()
Constructs a zero length time interval from 1970-01-01 to 1970-01-01.
MutableInterval
public MutableInterval(Object interval)
interval
- the time interval to copy
MutableInterval
public MutableInterval(Object interval,
Chronology chronology)
interval
- the time interval to copychronology
- the chronology to use, null means ISO default
MutableInterval
public MutableInterval(long startInstant,
long endInstant)
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.
MutableInterval
public MutableInterval(long startInstant,
long endInstant,
Chronology chronology)
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
MutableInterval
public MutableInterval(ReadableDuration duration,
ReadableInstant end)
Constructs an interval from a millisecond duration and an end instant.
duration
- the duration of this interval, null means zero lengthend
- end of this interval, null means now
MutableInterval
public MutableInterval(ReadableInstant start,
ReadableDuration duration)
Constructs an interval from a start instant and a duration.
start
- start of this interval, null means nowduration
- the duration of this interval, null means zero length
MutableInterval
public MutableInterval(ReadableInstant start,
ReadableInstant end)
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 nowend
- end of this interval, null means now
MutableInterval
public MutableInterval(ReadableInstant start,
ReadablePeriod period)
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 nowperiod
- the period of this interval, null means zero length
MutableInterval
public MutableInterval(ReadablePeriod period,
ReadableInstant end)
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 lengthend
- end of this interval, null means now
clone
public Object clone()
Clone this object.
copy
public MutableInterval copy()
Clone this object without having to cast the returned object.
- a clone of the this object.
setDurationAfterStart
public void setDurationAfterStart(long duration)
Sets the duration of this time interval, preserving the start instant.
duration
- new duration for interval
setDurationBeforeEnd
public void setDurationBeforeEnd(long duration)
Sets the duration of this time interval, preserving the end instant.
duration
- new duration for interval
setEndMillis
public void setEndMillis(long endInstant)
Sets the end of this time interval.
- setEndMillis in interface ReadWritableInterval
endInstant
- the end of the time interval,
millisecond instant from 1970-01-01T00:00:00Z
setInterval
public void setInterval(long startInstant,
long endInstant)
Sets this interval from two millisecond instants retaining the chronology.
- setInterval in interface ReadWritableInterval
startInstant
- the start of the time intervalendInstant
- the start of the time interval
setPeriodAfterStart
public void setPeriodAfterStart(ReadablePeriod period)
Sets the period of this time interval, preserving the start instant
and using the ISOChronology in the default zone for calculations.
- setPeriodAfterStart in interface ReadWritableInterval
period
- new period for interval, null means zero length
setPeriodBeforeEnd
public void setPeriodBeforeEnd(ReadablePeriod period)
Sets the period of this time interval, preserving the end instant
and using the ISOChronology in the default zone for calculations.
- setPeriodBeforeEnd in interface ReadWritableInterval
period
- new period for interval, null means zero length
setStartMillis
public void setStartMillis(long startInstant)
Sets the start of this time interval.
- setStartMillis in interface ReadWritableInterval
startInstant
- the start of the time interval,
millisecond instant from 1970-01-01T00:00:00Z
Copyright (c) 2001-2006 - Joda.org