T
- The type of the Data
(get
) associated with each interval.public final class TimeIntervalCollection1<T> extends Object implements List<TimeInterval1<T>>, IEquatable<TimeIntervalCollection1<T>>, IEquatableEpsilon<TimeIntervalCollection1<T>>, IFreezable
Constructor and Description |
---|
TimeIntervalCollection1()
Initializes a new, empty interval collection.
|
TimeIntervalCollection1(TimeInterval1<T> interval)
Initializes a new instance from a single interval.
|
TimeIntervalCollection1(TimeIntervalCollection1<T> collection)
Initializes a new interval collection by copying an existing one.
|
TimeIntervalCollection1(TimeIntervalCollection collection,
T data)
Initializes a new interval collection by copying an existing one that does not have data.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
TimeInterval1<T> item)
Adds a time interval to the list.
|
boolean |
add(TimeInterval1<T> item)
Adds an interval to the interval collection.
|
void |
add(TimeInterval1<T> item,
IEqualityComparer<T> dataComparer)
Adds an interval to the interval collection.
|
void |
add(TimeIntervalCollection1<T> collection)
Adds another interval collection to this interval collection.
|
void |
add(TimeIntervalCollection1<T> collection,
IEqualityComparer<T> dataComparer)
Adds another interval collection to this interval collection.
|
void |
add(TimeIntervalCollection collection,
T data)
Adds another interval collection to this interval collection.
|
void |
add(TimeIntervalCollection collection,
T data,
IEqualityComparer<T> dataComparer)
Adds another interval collection to this interval collection.
|
boolean |
addAll(Collection<? extends TimeInterval1<T>> c)
Appends all of the elements in the specified collection to the end of
this list, in the order that they are returned by the specified
collection's iterator (optional operation).
|
boolean |
addAll(int index,
Collection<? extends TimeInterval1<T>> c)
Inserts all of the elements in the specified collection into this
list at the specified position (optional operation).
|
void |
addMergingData(TimeInterval1<T> item,
MergeTimeIntervalDataCallback<T> mergeCallback)
Adds an interval to the interval collection.
|
void |
addMergingData(TimeIntervalCollection1<T> items,
MergeTimeIntervalDataCallback<T> mergeCallback)
Adds a collection of intervals to this interval collection.
|
void |
clear()
Removes all intervals from the interval collection.
|
TimeIntervalCollection1<T> |
complement(JulianDate startDate,
JulianDate endDate)
Computes the complement of this time interval collection.
|
TimeIntervalCollection1<T> |
complement(JulianDate startDate,
JulianDate endDate,
T data)
Computes the complement of this time interval collection.
|
boolean |
contains(JulianDate date)
Determines if the collection contains a specified date.
|
boolean |
contains(Object item)
Determines if this collection contains all of a specified interval.
|
boolean |
containsAll(Collection<?> c)
Returns true if this list contains all of the elements of the
specified collection.
|
<TNew> TimeIntervalCollection1<TNew> |
convertData(Converter<T,TNew> conversion)
Converts this collection to a different kind of data without changing the intervals.
|
void |
copyTo(TimeInterval1<T>[] array,
int arrayIndex)
Copies the intervals in this collection to an array.
|
boolean |
equals(Object obj)
Indicates whether another object is exactly equal to this instance.
|
boolean |
equals(TimeIntervalCollection1<T> other,
IEqualityComparer<T> dataComparer)
Indicates whether another instance of this type is exactly equal to this instance.
|
static <T> boolean |
equals(TimeIntervalCollection1<T> left,
TimeIntervalCollection1<T> right)
Returns
true if the two instances are exactly equal. |
boolean |
equalsEpsilon(TimeIntervalCollection1<T> other,
double epsilon)
Determines if this
TimeIntervalCollection is equal to another by comparing each of the TimeInterval elements in the two collections with TimeInterval.equalsEpsilon(agi.foundation.time.TimeInterval, double) . |
boolean |
equalsEpsilon(TimeIntervalCollection1<T> other,
double epsilon,
IEqualityComparer<T> dataComparer)
Determines if this
TimeIntervalCollection is equal to another by comparing each of the TimeInterval elements in the two collections with TimeInterval.equalsEpsilon(agi.foundation.time.TimeInterval, double) . |
boolean |
equalsType(TimeIntervalCollection1<T> other)
Indicates whether another instance of this type is exactly equal to this instance.
|
TimeInterval1<T> |
findIntervalContainingDate(JulianDate date)
Finds the
TimeInterval in this collection that contains a specified date. |
void |
freeze()
Freezes this object.
|
TimeInterval1<T> |
get(int index)
Gets the interval at the specified index.
|
static <T> TimeIntervalCollection1<T> |
getEmpty()
Gets an empty, read-only
TimeIntervalCollection1 . |
static <T> TimeIntervalCollection1<T> |
getInfinite()
Gets an unbounded, infinite, read-only
TimeIntervalCollection1 . |
boolean |
getIsEmpty()
Gets a value indicating whether this interval collection is empty,
where emptiness is defined as the count of intervals being equal to zero.
|
boolean |
getIsFrozen()
Gets a value indicating whether this object is frozen.
|
boolean |
getIsInfinite()
Gets a value indicating whether the interval collection is infinite.
|
JulianDate |
getStart()
Gets the start date of the first interval in the collection.
|
JulianDate |
getStop()
Gets the stop date of the last interval in the collection
|
int |
hashCode()
Returns a hash code for this instance, which is suitable for use in hashing algorithms and data structures like a hash table.
|
int |
indexOf(JulianDate date)
Finds the index of the
TimeInterval in this collection
that contains the specified date. |
int |
indexOf(Object item)
Finds the index of a given
TimeInterval1 in the collection. |
TimeIntervalCollection1<T> |
intersect(TimeInterval interval)
Computes the intersection of this interval collection with an interval without data.
|
TimeIntervalCollection1<T> |
intersect(TimeInterval1<T> interval)
Computes the intersection of this interval collection with an interval.
|
TimeIntervalCollection1<T> |
intersect(TimeInterval1<T> interval,
IEqualityComparer<T> dataComparer)
Computes the intersection of this interval collection with an interval.
|
TimeIntervalCollection1<T> |
intersect(TimeIntervalCollection intervals)
Computes the intersection of this interval collection with another, returning data from this one.
|
TimeIntervalCollection1<T> |
intersect(TimeIntervalCollection1<T> collection)
Computes the intersection of this interval collection with another.
|
TimeIntervalCollection1<T> |
intersect(TimeIntervalCollection1<T> collection,
IEqualityComparer<T> dataComparer)
Computes the intersection of this interval collection with another.
|
TimeIntervalCollection1<T> |
intersectMergingData(TimeInterval1<T> interval,
IEqualityComparer<T> dataComparer,
MergeTimeIntervalDataCallback<T> mergeCallback)
Computes the intersection of this interval collection with an interval.
|
TimeIntervalCollection1<T> |
intersectMergingData(TimeInterval1<T> interval,
MergeTimeIntervalDataCallback<T> mergeCallback)
Computes the intersection of this interval collection with an interval.
|
TimeIntervalCollection1<T> |
intersectMergingData(TimeIntervalCollection1<T> collection,
IEqualityComparer<T> dataComparer,
MergeTimeIntervalDataCallback<T> mergeCallback)
Computes the intersection of this interval collection with another.
|
TimeIntervalCollection1<T> |
intersectMergingData(TimeIntervalCollection1<T> collection,
MergeTimeIntervalDataCallback<T> mergeCallback)
Computes the intersection of this interval collection with another.
|
boolean |
isEmpty()
Returns true if this list contains no elements.
|
Iterator<TimeInterval1<T>> |
iterator()
Gets an enumerator for this interval list.
|
int |
lastIndexOf(Object o)
Returns the index of the last occurrence of the specified element
in this list, or -1 if this list does not contain the element.
|
ListIterator<TimeInterval1<T>> |
listIterator()
Returns a list iterator over the elements in this list (in proper
sequence).
|
ListIterator<TimeInterval1<T>> |
listIterator(int index)
Returns a list iterator over the elements in this list (in proper
sequence), starting at the specified position in the list.
|
static <T> boolean |
notEquals(TimeIntervalCollection1<T> left,
TimeIntervalCollection1<T> right)
Returns
true if the two instances are not exactly equal. |
TimeInterval1<T> |
remove(int index)
Removes the interval at a specified index in the collection.
|
boolean |
remove(Object item)
Removes the specified interval from this interval list, creating a hole
over the specified interval.
|
boolean |
remove(TimeInterval item)
Removes the specified interval from this interval list, creating a hole over the specified interval.
|
boolean |
remove(TimeIntervalCollection1<T> collection)
Removes the specified intervals from this interval list, creating a hole over the specified intervals.
|
boolean |
removeAll(Collection<?> c)
Removes from this list all of its elements that are contained in the
specified collection (optional operation).
|
TimeIntervalCollection |
removeData()
Converts this collection to a
TimeIntervalCollection by
removing the Data (get ) property from each interval. |
boolean |
removeLeavingEndpoints(TimeInterval item)
Removes the specified interval from this interval list, creating a hole
over the specified interval.
|
boolean |
removeLeavingEndpoints(TimeInterval1<T> item)
Removes the specified interval from this interval list,
creating a hole over the specified interval.
|
boolean |
removeLeavingEndpoints(TimeIntervalCollection1<T> collection)
Removes the specified intervals from this interval list,
creating a hole over the specified intervals.
|
boolean |
retainAll(Collection<?> c)
Retains only the elements in this list that are contained in the
specified collection (optional operation).
|
TimeInterval1<T> |
set(int index,
TimeInterval1<T> value)
Sets the interval at the specified index.
|
int |
size()
Gets the number of intervals in this interval collection.
|
List<TimeInterval1<T>> |
subList(int fromIndex,
int toIndex)
Returns a view of the portion of this list between the specified
fromIndex, inclusive, and toIndex, exclusive.
|
Object[] |
toArray()
Returns an array containing all of the elements in this list in proper
sequence (from first to last element).
|
<T> T[] |
toArray(T[] a)
Returns an array containing all of the elements in this list in
proper sequence (from first to last element); the runtime type of
the returned array is that of the specified array.
|
Duration |
toDuration()
Returns a
Duration representing the span of time represented by the sum of the individual time intervals
in the collection. |
String |
toString()
Returns a string representation of the object.
|
TimeIntervalCollection1<T> |
toTimeStandard(TimeStandard timeStandard)
Converts all times in this time interval collection to be the specified time standard.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
replaceAll, sort, spliterator
parallelStream, removeIf, stream
public TimeIntervalCollection1()
public TimeIntervalCollection1(@Nonnull TimeIntervalCollection1<T> collection)
The new collection will not be IsFrozen
(get
), even if the original was.
collection
- The existing collection to copy.public TimeIntervalCollection1(@Nonnull TimeIntervalCollection collection, T data)
Data
(get
) property of each interval in the new collection will be set to
a specified value.collection
- The collection to copy.data
- The Data
(get
) property to use for each interval in the new collection.public TimeIntervalCollection1(@Nonnull TimeInterval1<T> interval)
interval
- The interval to add to the collection.public final void freeze()
ObjectFrozenException
.freeze
in interface IFreezable
public final boolean getIsFrozen()
ObjectFrozenException
will be thrown if an attempt is made to do so.getIsFrozen
in interface IFreezable
@Nonnull public static <T> TimeIntervalCollection1<T> getEmpty()
TimeIntervalCollection1
.@Nonnull public static <T> TimeIntervalCollection1<T> getInfinite()
TimeIntervalCollection1
.public final void add(@Nullable TimeIntervalCollection1<T> collection)
Data
(get
) in each container, the data from
collection
takes precedence.collection
- The collection to add to this collection. This parameter can be
null, in which case nothing will be added.IllegalStateException
- Thrown when this TimeIntervalCollection
is read-only.public final void add(@Nullable TimeIntervalCollection1<T> collection, @Nonnull IEqualityComparer<T> dataComparer)
Data
(get
) in each container, the data from
collection
takes precedence.collection
- The collection to add to this collection. This parameter can be
null, in which case nothing will be added.dataComparer
- The comparer to use to determine if the Data
(get
) properties of two
intervals are equivalent.ObjectFrozenException
- Thrown when this TimeIntervalCollection
is read-only.public final void add(@Nullable TimeIntervalCollection collection, T data)
Data
(get
) in each container, the data from
collection
takes precedence.collection
- The collection to add to this collection. This parameter can be
null, in which case nothing will be added.data
- The Data
(get
) to use for all intervals in the source collection.IllegalStateException
- Thrown when this TimeIntervalCollection
is read-only.public final void add(@Nullable TimeIntervalCollection collection, T data, @Nonnull IEqualityComparer<T> dataComparer)
Data
(get
) in each container, the data from
collection
takes precedence.collection
- The collection to add to this collection. This parameter can be
null, in which case nothing will be added.data
- The Data
(get
) to use for all intervals in the source collection.dataComparer
- The comparer to use to determine if the Data
(get
) properties of two
intervals are equivalent.ObjectFrozenException
- Thrown when this TimeIntervalCollection
is read-only.public final boolean add(@Nonnull TimeInterval1<T> item)
Data
(get
) from
item
will replace the data already in the collection.
TimeInterval1.DefaultComparer
is used to compare the Data
(get
) properties of the intervals.
If item
overlaps any intervals already in the collection, the Data
(get
) property
from item
takes precedence and replaces the existing Data for the interval of overlap.
add
in interface Collection<TimeInterval1<T>>
add
in interface List<TimeInterval1<T>>
item
- The interval to add.Collection.add(E)
)IllegalStateException
- Thrown when this TimeIntervalCollection
is read-only.public final void add(@Nonnull TimeInterval1<T> item, @Nonnull IEqualityComparer<T> dataComparer)
Data
(get
) from
item
will replace the data already in the collection.
dataComparer
is used to compare the Data
(get
) properties of the intervals.
If item
overlaps any intervals already in the collection, the Data
(get
) property
from item
takes precedence and replaces the existing Data for the interval of overlap.
item
- The interval to add.dataComparer
- The object to use to compare the Data
(get
) properties of intervals.ObjectFrozenException
- Thrown when this TimeIntervalCollection
is read-only.public final void addMergingData(@Nonnull TimeInterval1<T> item, @Nullable MergeTimeIntervalDataCallback<T> mergeCallback)
Data
(get
)
on the interval in this collection with the Data
(get
) on the interval to add.item
- The interval to add.mergeCallback
- The method to use to "merge" the data on two intervals that intersect. If null
,
the data from this interval will be used.public final void addMergingData(@Nonnull TimeIntervalCollection1<T> items, @Nullable MergeTimeIntervalDataCallback<T> mergeCallback)
Data
(get
)
on the interval in this collection with the Data
(get
) on the interval to add.items
- The intervals to add.mergeCallback
- The callback to use to "merge" the data on two intervals that intersect. If null
,
the data from this interval will be used.@Nonnull public final TimeIntervalCollection1<T> intersect(@Nonnull TimeInterval interval)
interval
.interval
- The interval to intersect with this collection, regardless of data.@Nonnull public final TimeIntervalCollection1<T> intersect(@Nullable TimeIntervalCollection intervals)
intervals
- The collection to intersect with this collection. The parameter
can be null, in which case Intersect returns this instance.@Nonnull public final TimeIntervalCollection1<T> intersect(@Nonnull TimeInterval1<T> interval)
The returned collection will only contain the intervals that are in both collections.
If two intervals in the two collections overlap but have different Data
(get
),
the overlapping part will NOT be included in the resulting collection.
interval
- The interval to intersect with this collection@Nonnull public final TimeIntervalCollection1<T> intersect(@Nonnull TimeInterval1<T> interval, @Nonnull IEqualityComparer<T> dataComparer)
The returned collection will only contain the intervals that are in both collections.
If two intervals in the two collections overlap but have different Data
(get
),
the overlapping part will NOT be included in the resulting collection.
interval
- The interval to intersect with this collectiondataComparer
- The object to use to compare the Data
(get
) properties of intervals.@Nonnull public final TimeIntervalCollection1<T> intersectMergingData(@Nonnull TimeInterval1<T> interval, @Nullable MergeTimeIntervalDataCallback<T> mergeCallback)
Data
(get
) on each into a single
value that is applied to the interval of intersection. If the mergeCallback
is
null
, intervals that overlap in time will not be included in the returned intersection collection
if they have different data.
The returned collection will only contain the intervals that are in both collections.
If two intervals in the two collections overlap but have different Data
(get
),
the overlapping part will NOT be included in the resulting collection.
interval
- The interval to intersect with this collectionmergeCallback
- The method to use to "merge" the data on two intervals that intersect. If null
,
the data from this interval will be used.@Nonnull public final TimeIntervalCollection1<T> intersectMergingData(@Nonnull TimeInterval1<T> interval, @Nonnull IEqualityComparer<T> dataComparer, @Nullable MergeTimeIntervalDataCallback<T> mergeCallback)
Data
(get
) on each into a single
value that is applied to the interval of intersection. If the mergeCallback
is
null
, intervals that overlap in time will not be included in the returned intersection collection
if they have different data.
The returned collection will only contain the intervals that are in both collections.
If two intervals in the two collections overlap but have different Data
(get
),
the overlapping part will NOT be included in the resulting collection.
interval
- The interval to intersect with this collectiondataComparer
- The object to use to compare the Data
(get
) properties of intervals.mergeCallback
- The method to use to "merge" the data on two intervals that intersect. If null
,
the data from this interval will be used.@Nonnull public final TimeIntervalCollection1<T> intersect(@Nullable TimeIntervalCollection1<T> collection)
The returned collection will only contain the intervals that are in both collections.
If two intervals in the two collections overlap but have different Data
(get
),
the overlapping part will NOT be included in the resulting collection.
collection
- The collection to intersect with this collection. The parameter
can be null, in which case Intersect returns this instance.@Nonnull public final TimeIntervalCollection1<T> intersect(@Nullable TimeIntervalCollection1<T> collection, @Nonnull IEqualityComparer<T> dataComparer)
The returned collection will only contain the intervals that are in both collections.
If two intervals in the two collections overlap but have different Data
(get
),
the overlapping part will NOT be included in the resulting collection.
collection
- The collection to intersect with this collection. The parameter
can be null, in which case Intersect returns this instance.dataComparer
- The object to use to compare the Data
(get
) properties of intervals.@Nonnull public final TimeIntervalCollection1<T> intersectMergingData(@Nullable TimeIntervalCollection1<T> collection, @Nullable MergeTimeIntervalDataCallback<T> mergeCallback)
Data
(get
) on each into a single
value that is applied to the interval of intersection. If the mergeCallback
is
null
, intervals that overlap in time will not be included in the returned intersection collection
if they have different data.collection
- The collection to intersect with this collection. The parameter
can be null, in which case Intersect returns this instance.mergeCallback
- The method to use to "merge" the data on two intervals that intersect. If null
,
the data from this interval will be used.@Nonnull public final TimeIntervalCollection1<T> intersectMergingData(@Nullable TimeIntervalCollection1<T> collection, @Nonnull IEqualityComparer<T> dataComparer, @Nullable MergeTimeIntervalDataCallback<T> mergeCallback)
Data
(get
) on each into a single
value that is applied to the interval of intersection. If the mergeCallback
is
null
, intervals that overlap in time will not be included in the returned intersection collection
if they have different data.collection
- The collection to intersect with this collection. The parameter
can be null, in which case Intersect returns this instance.dataComparer
- The object to use to compare the Data
(get
) properties of intervals.mergeCallback
- The callback to use to merge the data in overlapping intervals. If null
,
the data from this interval will be used.public final void clear()
clear
in interface Collection<TimeInterval1<T>>
clear
in interface List<TimeInterval1<T>>
ObjectFrozenException
- Thrown when this TimeIntervalCollection
is read-only.public final boolean getIsEmpty()
TimeIntervalCollection.toDuration()
and check for equality with Zero
(get
).public final boolean getIsInfinite()
public final int indexOf(Object item)
TimeInterval1
in the collection. This method requires
that the given interval exactly match an interval in the collection. Intervals with
different time standards, different data, or even slightly different values due to floating point noise
will be considered to be different.indexOf
in interface List<TimeInterval1<T>>
item
- The interval to find.public final int indexOf(@Nonnull JulianDate date)
TimeInterval
in this collection
that contains the specified date.date
- The Julian date to find.date
,
or if no interval starts after the specified date, the bitwise complement of Count
(get
).@Nullable public final TimeInterval1<T> findIntervalContainingDate(@Nonnull JulianDate date)
TimeInterval
in this collection that contains a specified date.date
- The date to look for in the collection.TimeInterval1
in the collection that contains the date,
or null
if the collection does not contain the date at all.public final boolean contains(@Nonnull JulianDate date)
date
- The date to look for in the collection.true
if this interval collection contains the specified date; otherwise false
.public final boolean contains(@Nonnull Object item)
contains
in interface Collection<TimeInterval1<T>>
contains
in interface List<TimeInterval1<T>>
item
- The interval to check.true
if this interval collection contains the specified interval,
or false
if this collection has any gaps over the input interval.
Data
(get
) is ignored by this method.public final void copyTo(TimeInterval1<T>[] array, int arrayIndex)
array
- The destination array.arrayIndex
- The index at which to begin copying.public final int size()
size
in interface Collection<TimeInterval1<T>>
size
in interface List<TimeInterval1<T>>
public final boolean remove(@Nonnull TimeIntervalCollection1<T> collection)
collection
- The interval collection to remove.true
if any part of the input interval collection was in the interval collection; otherwise false
.public final TimeInterval1<T> remove(int index)
remove
in interface List<TimeInterval1<T>>
index
- The index of the interval to remove.public final boolean remove(@Nonnull Object item)
remove
in interface Collection<TimeInterval1<T>>
remove
in interface List<TimeInterval1<T>>
item
- The interval to remove.true
if any part of the input interval was in the interval list; otherwise false
.ObjectFrozenException
- Thrown when this TimeIntervalCollection
is read-only.public final boolean remove(@Nonnull TimeInterval item)
item
- The interval to remove.true
if any part of the input interval was in the interval list; otherwise false
.ObjectFrozenException
- Thrown when this TimeIntervalCollection
is read-only.public final boolean removeLeavingEndpoints(@Nonnull TimeIntervalCollection1<T> collection)
collection
- The interval collection to remove.true
if any part of the input interval collection was in the interval collection; otherwise false
.public final boolean removeLeavingEndpoints(@Nonnull TimeInterval1<T> item)
item
- The interval to remove.true
if any part of the input interval was in the interval list; otherwise false
.ObjectFrozenException
- Thrown when this TimeIntervalCollection
is read-only.public final boolean removeLeavingEndpoints(@Nonnull TimeInterval item)
item
- The interval to remove.true
if any part of the input interval was in the interval list; otherwise false
.ObjectFrozenException
- Thrown when this TimeIntervalCollection
is read-only.@Nonnull public final TimeIntervalCollection1<T> complement(@Nonnull JulianDate startDate, @Nonnull JulianDate endDate)
The new TimeIntervalCollection1
is the complement of this TimeIntervalCollection1
within
the given startDate
and endDate
bounds. In other words,
the new TimeIntervalCollection1
will represent all dates that are between the start and end dates
and that were NOT present in the original collection. Any dates before the given startDate
and
after the given endDate
are removed.
All TimeInterval1
instances in the returned collection will have a default
Data
(get
) property.
startDate
- The earliest date to include in the complement.endDate
- The latest date to include in the complement.@Nonnull public final TimeIntervalCollection1<T> complement(@Nonnull JulianDate startDate, @Nonnull JulianDate endDate, T data)
The new TimeIntervalCollection1
is the complement of this TimeIntervalCollection1
within
the given startDate
and endDate
bounds. In other words,
the new TimeIntervalCollection1
will represent all dates that are between the start and end dates
and that were NOT present in the original collection. Any dates before the given startDate
and
after the given endDate
are removed.
startDate
- The earliest date to include in the complement.endDate
- The latest date to include in the complement.data
- The value to set for the Data
(get
) property for each TimeInterval
in the returned collection.@Nonnull public final TimeIntervalCollection1<T> toTimeStandard(TimeStandard timeStandard)
timeStandard
- The time standard to use.@Nonnull public final <TNew> TimeIntervalCollection1<TNew> convertData(@Nonnull Converter<T,TNew> conversion)
TNew
- The new type of data.conversion
- The function used to convert from the existing data to the new data.public final Iterator<TimeInterval1<T>> iterator()
iterator
in interface Iterable<TimeInterval1<T>>
iterator
in interface Collection<TimeInterval1<T>>
iterator
in interface List<TimeInterval1<T>>
public final TimeInterval1<T> get(int index)
get
in interface List<TimeInterval1<T>>
index
- The index.public final TimeInterval1<T> set(int index, TimeInterval1<T> value)
set
in interface List<TimeInterval1<T>>
index
- The index.value
- element to be stored at the specified position@Nonnull public final JulianDate getStart()
@Nonnull public final JulianDate getStop()
@Nonnull public final Duration toDuration()
Duration
representing the span of time represented by the sum of the individual time intervals
in the collection.public String toString()
java.lang.Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public final boolean equalsType(TimeIntervalCollection1<T> other)
In order for two collections to be considered equal, each TimeInterval
in one collection must
be equal to the TimeInterval
at the same index in the other collection.
equalsType
in interface IEquatable<TimeIntervalCollection1<T>>
other
- The instance to compare to this instance.true
if other
represents the same value as this instance; otherwise false
.public final boolean equals(TimeIntervalCollection1<T> other, IEqualityComparer<T> dataComparer)
In order for two collections to be considered equal, each TimeInterval
in one collection must
be equal to the TimeInterval
at the same index in the other collection.
other
- The instance to compare to this instance.dataComparer
- The object to use to compare the Data
(get
) properties of intervals.true
if other
represents the same value as this instance; otherwise false
.public int hashCode()
hashCode
in interface Collection<TimeInterval1<T>>
hashCode
in interface List<TimeInterval1<T>>
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public boolean equals(Object obj)
In order for two collections to be considered equal, each TimeInterval
in one collection must
be equal to the TimeInterval
at the same index in the other collection.
equals
in interface Collection<TimeInterval1<T>>
equals
in interface List<TimeInterval1<T>>
equals
in class Object
obj
- 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()
,
HashMap
public static <T> boolean equals(TimeIntervalCollection1<T> left, TimeIntervalCollection1<T> right)
true
if the two instances are exactly equal.
In order for two collections to be considered equal, each TimeInterval
in one collection must
be equal to the TimeInterval
at the same index in the other collection.
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 <T> boolean notEquals(TimeIntervalCollection1<T> left, TimeIntervalCollection1<T> right)
true
if the two instances are not exactly equal.
In order for two collections to be considered equal, each TimeInterval
in one collection must
be equal to the TimeInterval
at the same index in the other collection.
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
.public final boolean equalsEpsilon(TimeIntervalCollection1<T> other, double epsilon)
TimeIntervalCollection
is equal to another by comparing each of the TimeInterval
elements in the two collections with TimeInterval.equalsEpsilon(agi.foundation.time.TimeInterval, double)
.equalsEpsilon
in interface IEquatableEpsilon<TimeIntervalCollection1<T>>
other
- A TimeIntervalCollection1
to compare this one to.epsilon
- The largest difference between the Start and Stop dates, in seconds, such that they will be considered equal.TimeIntervals
are equal as defined by the epsilon value.public final boolean equalsEpsilon(TimeIntervalCollection1<T> other, double epsilon, @Nonnull IEqualityComparer<T> dataComparer)
TimeIntervalCollection
is equal to another by comparing each of the TimeInterval
elements in the two collections with TimeInterval.equalsEpsilon(agi.foundation.time.TimeInterval, double)
.other
- A TimeIntervalCollection1
to compare this one to.epsilon
- The largest difference between the Start and Stop dates, in seconds, such that they will be considered equal.dataComparer
- The object to use to compare the Data
(get
) properties of intervals.TimeIntervals
are equal as defined by the epsilon value.@Nonnull public final TimeIntervalCollection removeData()
TimeIntervalCollection
by
removing the Data
(get
) property from each interval.public final void add(int index, TimeInterval1<T> item)
TimeIntervalCollection1.add(TimeInterval1)
- the
index
parameter is ignored.add
in interface List<TimeInterval1<T>>
index
- Ignored.item
- The interval to add to this collection.public final boolean isEmpty()
java.util.List
isEmpty
in interface Collection<TimeInterval1<T>>
isEmpty
in interface List<TimeInterval1<T>>
public final boolean addAll(Collection<? extends TimeInterval1<T>> c)
java.util.List
addAll
in interface Collection<TimeInterval1<T>>
addAll
in interface List<TimeInterval1<T>>
c
- collection containing elements to be added to this listList.add(Object)
public final boolean addAll(int index, Collection<? extends TimeInterval1<T>> c)
java.util.List
addAll
in interface List<TimeInterval1<T>>
index
- index at which to insert the first element from the
specified collectionc
- collection containing elements to be added to this listpublic final boolean containsAll(Collection<?> c)
java.util.List
containsAll
in interface Collection<TimeInterval1<T>>
containsAll
in interface List<TimeInterval1<T>>
c
- collection to be checked for containment in this listList.contains(Object)
public final Object[] toArray()
java.util.List
The returned array will be "safe" in that no references to it are maintained by this list. (In other words, this method must allocate a new array even if this list is backed by an array). The caller is thus free to modify the returned array.
This method acts as bridge between array-based and collection-based APIs.
toArray
in interface Collection<TimeInterval1<T>>
toArray
in interface List<TimeInterval1<T>>
Arrays.asList(Object[])
public final <T> T[] toArray(T[] a)
java.util.List
If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the list is set to null. (This is useful in determining the length of the list only if the caller knows that the list does not contain any null elements.)
Like the List.toArray()
method, this method acts as bridge between
array-based and collection-based APIs. Further, this method allows
precise control over the runtime type of the output array, and may,
under certain circumstances, be used to save allocation costs.
Suppose x is a list known to contain only strings. The following code can be used to dump the list into a newly allocated array of String:
String[] y = x.toArray(new String[0]);
Note that toArray(new Object[0]) is identical in function to
toArray().toArray
in interface Collection<TimeInterval1<T>>
toArray
in interface List<TimeInterval1<T>>
T
- the runtime type of the array to contain the collectiona
- the array into which the elements of this list are to
be stored, if it is big enough; otherwise, a new array of the
same runtime type is allocated for this purpose.public final int lastIndexOf(Object o)
java.util.List
lastIndexOf
in interface List<TimeInterval1<T>>
o
- element to search forpublic final ListIterator<TimeInterval1<T>> listIterator()
java.util.List
listIterator
in interface List<TimeInterval1<T>>
public final ListIterator<TimeInterval1<T>> listIterator(int index)
java.util.List
next
.
An initial call to previous
would
return the element with the specified index minus one.listIterator
in interface List<TimeInterval1<T>>
index
- index of the first element to be returned from the
list iterator (by a call to next
)public final List<TimeInterval1<T>> subList(int fromIndex, int toIndex)
java.util.List
This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a list can be used as a range operation by passing a subList view instead of a whole list. For example, the following idiom removes a range of elements from a list:
list.subList(from, to).clear();
Similar idioms may be constructed for indexOf and
lastIndexOf, and all of the algorithms in the
Collections class can be applied to a subList.The semantics of the list returned by this method become undefined if the backing list (i.e., this list) is structurally modified in any way other than via the returned list. (Structural modifications are those that change the size of this list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.)
subList
in interface List<TimeInterval1<T>>
fromIndex
- low endpoint (inclusive) of the subListtoIndex
- high endpoint (exclusive) of the subListpublic final boolean removeAll(Collection<?> c)
java.util.List
removeAll
in interface Collection<TimeInterval1<T>>
removeAll
in interface List<TimeInterval1<T>>
c
- collection containing elements to be removed from this listList.remove(Object)
,
List.contains(Object)
public final boolean retainAll(Collection<?> c)
java.util.List
retainAll
in interface Collection<TimeInterval1<T>>
retainAll
in interface List<TimeInterval1<T>>
c
- collection containing elements to be retained in this listList.remove(Object)
,
List.contains(Object)