public final class AbsoluteDateInterval extends ComparableInterval<AbsoluteDate>
This class implements an interval based on the AbsoluteDate class,
using the ComparableInterval class.
This implementation enforces that AbsoluteDate.PAST_INFINITE
and
AbsoluteDate.FUTURE_INFINITE
cannot be closed boundaries.
final AbsoluteDate lowEnd = new AbsoluteDate();
final AbsoluteDate upEnd = new AbsoluteDate(lowEnd, 4578.14);
final IntervalEndpointType lowInt = IntervalEndpointType.CLOSED;
final IntervalEndpointType upInt = IntervalEndpointType.OPEN;
final AbsoluteDateInterval dateInterval = new AbsoluteDateInterval(lowInt, lowEnd, upEnd, upInt);
Constructor and Description |
---|
AbsoluteDateInterval(IntervalEndpointType lowerEndpointIn,
AbsoluteDate lowerDataIn,
AbsoluteDate upperDataIn,
IntervalEndpointType upperEndpointIn)
Constructor for an AbsoluteDate interval.
|
Modifier and Type | Method and Description |
---|---|
int |
compareDurationTo(AbsoluteDateInterval interval)
Checks if the duration of the interval is longer, shorter or equal to the duration of another interval.
It returns a positive integer if the duration is longer, a negative integer if the duration is shorter and zero if the durations of the two intervals are identical. The method checks also the lower and upper end points of the intervals, considering that an interval with an open end point is shorter than an interval with the same duration and a closed end point. |
double |
durationFrom(AbsoluteDateInterval interval)
Computes the duration in seconds between the two intervals.
The duration between two intervals is the duration between the end of the earlier interval and the beginning of the later. If the intervals overlap, this duration is 0. The sign of the result is positive if the given interval comes earlier. |
double |
getDuration()
Computes the interval duration (its length) in seconds.
The duration is the number of seconds physically elapsed between the lower and the upper endpoint, as computed by AbsoluteDate.durationFrom() .This means the duration is measured in a linear time scale (TAI time scale). |
AbsoluteDateInterval |
getIntersectionWith(AbsoluteDateInterval interval)
Intersects the interval with another interval if possible (i.e.
|
AbsoluteDateInterval |
mergeTo(AbsoluteDateInterval interval)
Merges the interval with another interval if possible (i.e.
|
compareLowerEndTo, compareTo, compareUpperEndTo, contains, equals, hashCode, includes, isConnectedTo, overlaps
getLowerData, getLowerEndpoint, getUpperData, getUpperEndpoint, toString
public AbsoluteDateInterval(IntervalEndpointType lowerEndpointIn, AbsoluteDate lowerDataIn, AbsoluteDate upperDataIn, IntervalEndpointType upperEndpointIn)
lowerDataIn
- lower end AbsoluteDateupperDataIn
- upper end AbsoluteDatelowerEndpointIn
- lower end boundary typeupperEndpointIn
- upper end boundary typeMathIllegalArgumentException
- when the interval is invalid (unchecked exception).GenericInterval
and ComparableInterval
checks, the infinite
date boundaries also have to be opened.ComparableInterval
,
GenericInterval
,
AbsoluteDate
public double getDuration()
AbsoluteDate.durationFrom()
.AbsoluteDate.durationFrom(AbsoluteDate)
public double durationFrom(AbsoluteDateInterval interval)
interval
- the given intervalAbsoluteDate.durationFrom(AbsoluteDate)
public int compareDurationTo(AbsoluteDateInterval interval)
interval
- other intervalpublic AbsoluteDateInterval mergeTo(AbsoluteDateInterval interval)
AbsoluteDateInterval
.interval
- the interval to be mergedpublic AbsoluteDateInterval getIntersectionWith(AbsoluteDateInterval interval)
AbsoluteDateInterval
.interval
- the interval to be intersectedCopyright © 2018 CNES. All Rights Reserved.