org.orekit.utils
Class AbsoluteDateInterval

java.lang.Object
  extended by org.orekit.utils.GenericInterval<T>
      extended by org.orekit.utils.ComparableInterval<AbsoluteDate>
          extended by org.orekit.utils.AbsoluteDateInterval
All Implemented Interfaces:
Serializable, Comparable<ComparableInterval<AbsoluteDate>>

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.

Since:
3.0
Version:
$Id: AbsoluteDateInterval.java 17602 2017-05-18 08:25:23Z bignon $
Author:
cardosop
See Also:
Serialized Form
Use sample :

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);

Concurrency :
immutable

Constructor Summary
AbsoluteDateInterval(IntervalEndpointType lowerEndpointIn, AbsoluteDate lowerDataIn, AbsoluteDate upperDataIn, IntervalEndpointType upperEndpointIn)
          Constructor for an AbsoluteDate interval.
 
Method Summary
 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.
 
Methods inherited from class org.orekit.utils.ComparableInterval
compareLowerEndTo, compareTo, compareUpperEndTo, contains, equals, hashCode, includes, isConnectedTo, overlaps
 
Methods inherited from class org.orekit.utils.GenericInterval
getLowerData, getLowerEndpoint, getUpperData, getUpperEndpoint, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbsoluteDateInterval

public AbsoluteDateInterval(IntervalEndpointType lowerEndpointIn,
                            AbsoluteDate lowerDataIn,
                            AbsoluteDate upperDataIn,
                            IntervalEndpointType upperEndpointIn)
Constructor for an AbsoluteDate interval.

Parameters:
lowerDataIn - lower end AbsoluteDate
upperDataIn - upper end AbsoluteDate
lowerEndpointIn - lower end boundary type
upperEndpointIn - upper end boundary type
Throws:
MathIllegalArgumentException - when the interval is invalid (unchecked exception).
In addition to GenericInterval and ComparableInterval checks, the infinite date boundaries also have to be opened.
See Also:
ComparableInterval, GenericInterval, AbsoluteDate
Method Detail

getDuration

public 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).

Returns:
the interval duration in seconds
See Also:
AbsoluteDate.durationFrom(AbsoluteDate)

durationFrom

public 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.

Parameters:
interval - the given interval
Returns:
the duration in seconds
See Also:
AbsoluteDate.durationFrom(AbsoluteDate)

compareDurationTo

public 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.

Parameters:
interval - other interval
Returns:
a negative integer, zero, or a positive integer

mergeTo

public AbsoluteDateInterval mergeTo(AbsoluteDateInterval interval)
Merges the interval with another interval if possible (i.e. the intervals must overlap or be connected) and returns the merged AbsoluteDateInterval.
If the intervals do not overlap or are not connected, the method returns null.

Parameters:
interval - the interval to be merged
Returns:
the merged interval

getIntersectionWith

public AbsoluteDateInterval getIntersectionWith(AbsoluteDateInterval interval)
Intersects the interval with another interval if possible (i.e. the intervals must overlap) and returns the intersected AbsoluteDateInterval.
If the intervals do not overlap, the method returns null.

Parameters:
interval - the interval to be intersected
Returns:
the interval representing the intersection between the two intervals.


Copyright © 2017 CNES. All Rights Reserved.