TimeIntervalCollection

TimeIntervalCollection

new

A non-overlapping collection of TimeIntervals sorted by start date.

See:
Source:

Methods

Adds an interval to the collection, merging intervals that contain the same data and splitting intervals of different data as needed in order to maintain a non-overlapping collection. The data in the new interval takes precedence over any existing intervals in the collection.

Parameters:
Name Type Argument Description
interval TimeInterval The interval to add.
equalsCallback Function <optional>
An optional function which takes the data from two TimeIntervals and returns true if they are equal, false otherwise. If this function is not provided, the Javascript equality operator is used.
Throws:
DeveloperError : interval is required.

Clears the collection.

Returns true if the specified date is contained in the interval collection.

Parameters:
Name Type Description
date JulianDate The date to search for.
Throws:
DeveloperError : date is required.
Returns:
True if the specified date is contained in the interval collection, undefined otherwise.

Returns the first interval in the collection that matches the specified parameters. All parameters are optional and undefined parameters are treated as a don't care condition.

Parameters:
Name Type Argument Description
start JulianDate <optional>
The start of the interval.
stop JulianDate <optional>
The end of the interval.
isStartIncluded JulianDate <optional>
True if the start date is included.
isStopIncluded JulianDate <optional>
True if the stop date is included.
Returns:
The first interval in the collection that matches the specified parameters.

Returns the interval which contains the specified date.

Parameters:
Name Type Description
date JulianDate The date to search for.
Throws:
DeveloperError : date is required.
Returns:
The interval containing the specified date, undefined if no such interval exists.

Gets the interval at the specified index.

Parameters:
Name Type Description
index Number The index of the interval to retrieve.
Throws:
DeveloperError : index must be a number.
Returns:
TimeInterval The TimeInterval at the specified index, or undefined if no such index exists.

Gets the number of intervals in the collection.

Returns:
Number The number of intervals in the collection.

Gets the start date of the collection.

Returns:
JulianDate The start date of the collection or undefined if the collection is empty.

Gets the stop date of the collection.

Returns:
JulianDate The stop date of the collection or undefined if the collection is empty.

Returns the index of the interval in the collection that contains the specified date.

Parameters:
Name Type Description
date JulianDate The date to search for.
Throws:
DeveloperError : date is required.
Returns:
The index of the interval which contains the specified date, if no such interval exists, it returns a negative number which is the bitwise complement of the index of the next interval that starts after the date, or if no interval starts after the specified date, the bitwise complement of the length of the collection.

Creates a new TimeIntervalCollection which is the intersection of this collection and the provided collection.

Parameters:
Name Type Argument Description
timeIntervalCollection TimeIntervalCollection The collection to intersect with.
equalsCallback Function <optional>
An optional function which takes the data from two TimeIntervals and returns true if they are equal, false otherwise. If this function is not provided, the Javascript equality operator is used.
mergeCallback Function <optional>
An optional function which takes the data from two TimeIntervals and returns a merged version of the data. If this parameter is omitted, the interval data from this collection will be used.
Throws:
DeveloperError : timeIntervalCollection is required.
Returns:
A new TimeIntervalCollection which is the intersection of this collection and the provided collection.

Creates a new TimeIntervalCollection which is the intersection of this collection and the provided interval.

Parameters:
Name Type Argument Description
interval TimeInterval The interval to intersect with.
equalsCallback Function <optional>
An optional function which takes the data from two TimeIntervals and returns true if they are equal, false otherwise. If this function is not provided, the equality operator will be used.
mergeCallback Function <optional>
An optional function which takes the data from two TimeIntervals and returns a merged version of the data. If this parameter is omitted, the interval data from this collection will be used.
Throws:
DeveloperError : timeIntervalCollection is required.
Returns:
A new TimeIntervalCollection which is the intersection of this collection and the provided collection.

Returns true if the collection is empty, false otherwise.

Returns:
true if the collection is empty, false otherwise.

Removes the specified interval from this interval collection, creating a hole over the specified interval. The Data property of the input interval is ignored.

Parameters:
Name Type Description
interval TimeInterval The interval to remove.
Throws:
DeveloperError : interval is required.
Returns:
true if the interval was removed, false if no part of the interval was in the collection.