public final class TimeInterval extends Object implements IEquatable<TimeInterval>, IEquatableEpsilon<TimeInterval>
| Constructor and Description |
|---|
TimeInterval(JulianDate start,
JulianDate stop)
Initializes a new interval with the specified start date and stop date.
|
TimeInterval(JulianDate start,
JulianDate stop,
boolean isStartIncluded,
boolean isStopIncluded)
Initializes a new interval with the specified start date, stop date, and data,
also specifying whether the start and stop dates are included.
|
| Modifier and Type | Method and Description |
|---|---|
TimeIntervalCollection |
add(TimeInterval other)
Adds two intervals together, producing an interval list that
includes both intervals.
|
TimeIntervalCollection |
add(TimeIntervalCollection intervalList)
Adds an interval list to this interval, producing a new interval list
that includes this interval plus all intervals in the input list.
|
<T> TimeInterval1<T> |
addData(T data)
Creates a
TimeInterval1 that is equivalent to this time interval,
but with the specified Data (get) value. |
boolean |
contains(JulianDate date)
Determines if the interval contains a specified date.
|
boolean |
equals(Object obj)
Indicates whether another object is exactly equal to this instance.
|
static boolean |
equals(TimeInterval left,
TimeInterval right)
Returns
true if the two instances are exactly equal. |
boolean |
equalsEpsilon(TimeInterval other,
double epsilon)
|
boolean |
equalsType(TimeInterval other)
Indicates whether another instance of this type is exactly equal to this instance.
|
static TimeInterval |
getEmpty()
Gets an empty interval.
|
static TimeInterval |
getInfinite()
Gets an interval that represents the maximum possible span of time.
|
boolean |
getIsEmpty()
Gets a value indicating whether the interval is empty.
|
boolean |
getIsStartIncluded()
Gets a value indicating whether the
Start (get) date is included in the interval. |
boolean |
getIsStopIncluded()
Gets a value indicating whether the
Stop (get) date is included in the interval. |
JulianDate |
getStart()
Gets the start date of the interval.
|
JulianDate |
getStop()
Gets the stop date of the interval.
|
int |
hashCode()
Returns a hash code for this instance, which is suitable for use in hashing algorithms and data structures like a hash table.
|
TimeInterval |
intersect(TimeInterval other)
Computes an interval which is the intersection of this interval with another.
|
static boolean |
notEquals(TimeInterval left,
TimeInterval right)
Returns
true if the two instances are not exactly equal. |
Duration |
toDuration()
|
String |
toString()
Returns a string with interval in the format "[Start, Stop)".
|
TimeInterval |
toTimeStandard(TimeStandard timeStandard)
Returns a
TimeInterval equivalent to this one where the time standard
of the start and end dates has been converted to the specified standard. |
public TimeInterval(@Nonnull JulianDate start, @Nonnull JulianDate stop)
start - The first date in the interval.stop - The last date in the interval.public TimeInterval(@Nonnull JulianDate start, @Nonnull JulianDate stop, boolean isStartIncluded, boolean isStopIncluded)
start - The date that starts the interval.stop - The date that stops the interval.isStartIncluded - true if the start date is included in the interval.isStopIncluded - true if the stop date is included in the interval.@Nonnull public final JulianDate getStart()
@Nonnull public final JulianDate getStop()
public final boolean getIsStartIncluded()
Start (get) date is included in the interval.public final boolean getIsStopIncluded()
Stop (get) date is included in the interval.public final boolean getIsEmpty()
TimeInterval.toDuration() and check for equality with Zero (get).@Nonnull public final Duration toDuration()
Duration representing the span of time between the
Start (get) and Stop (get) of the interval.@Nonnull public final TimeInterval toTimeStandard(TimeStandard timeStandard)
TimeInterval equivalent to this one where the time standard
of the start and end dates has been converted to the specified standard.timeStandard - The time standard of the new interval.@Nonnull public final TimeInterval intersect(@Nullable TimeInterval other)
other - The interval to intersect with this interval.@Nonnull public final TimeIntervalCollection add(@Nullable TimeInterval other)
other - The interval to add.@Nonnull public final TimeIntervalCollection add(@Nullable TimeIntervalCollection intervalList)
intervalList - The interval list to add.public final boolean contains(@Nonnull JulianDate date)
date - The date to test.true if the interval contains the date; otherwise false.@Nonnull public final <T> TimeInterval1<T> addData(T data)
TimeInterval1 that is equivalent to this time interval,
but with the specified Data (get) value.T - The type of the data.data - The data value.public final boolean equalsEpsilon(@Nullable TimeInterval other, double epsilon)
Start (get) and Stop (get) properties of the
two intervals. The dates are considered equal if they are within epsilon
seconds of each other. All other properties must be identical.equalsEpsilon in interface IEquatableEpsilon<TimeInterval>other - The time interval to compare to this time interval.epsilon - The largest difference between the Start (get) and Stop (get) dates, in seconds, such that they will be considered equal.Start (get) and Stop (get) dates of the intervals are equal as defined by the epsilon value and all other properties are identical.public final boolean equalsType(TimeInterval other)
equalsType in interface IEquatable<TimeInterval>other - The instance to compare to this instance.true if other represents the same value as this instance; otherwise false.public boolean equals(Object obj)
equals in class Objectobj - The object to compare to this instance.true if obj is an instance of this type and represents the same value as this instance; otherwise false.Object.hashCode(),
HashMappublic String toString()
public int hashCode()
hashCode in class ObjectObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)public static boolean equals(TimeInterval left, TimeInterval right)
true if the two instances are exactly equal.left - The instance to compare to right.right - The instance to compare to left.true if left represents the same value as right; otherwise false.public static boolean notEquals(TimeInterval left, TimeInterval right)
true if the two instances are not exactly equal.left - The instance to compare to right.right - The instance to compare to left.true if left does not represent the same value as right; otherwise false.@Nonnull public static TimeInterval getEmpty()
@Nonnull public static TimeInterval getInfinite()