A non-overlapping collection of
TimeInterval instances sorted by start time.
| Name | Type | Description |
|---|---|---|
intervals |
Array.<TimeInterval> | optional An array of intervals to add to the collection. |
Members
-
readonlychangedEvent : Event
-
Gets an event that is raised whenever the collection of intervals change.
-
Gets whether or not the collection is empty.
-
Gets whether or not the start time is included in the collection.
-
Gets whether or not the stop time is included in the collection.
-
Gets the number of intervals in the collection.
-
readonlystart : JulianDate
-
Gets the start time of the collection.
-
readonlystop : JulianDate
-
Gets the stop time of the collection.
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.
Name Type Description intervalTimeInterval The interval to add. dataComparerTimeInterval~DataComparer optional A function which compares the data of the two intervals. If omitted, reference equality is used. -
Checks if the specified date is inside this collection.
Name Type Description julianDateJulianDate The date to check. Returns:
trueif the collection contains the specified date,falseotherwise. -
Compares this instance against the provided instance componentwise and returns
trueif they are equal,falseotherwise.Name Type Description rightTimeIntervalCollection optional The right hand side collection. dataComparerTimeInterval~DataComparer optional A function which compares the data of the two intervals. If omitted, reference equality is used. Returns:
trueif they are equal,falseotherwise. -
Finds and returns the data for the interval that contains the specified date.
Name Type Description dateJulianDate The date to search for. Returns:
The data for the interval containing the specified date, orundefinedif no such interval exists. -
findInterval(options) → TimeInterval
-
Returns the first interval in the collection that matches the specified parameters. All parameters are optional and
undefinedparameters are treated as a don't care condition.Name Type Description optionsObject optional Object with the following properties: Name Type Description startJulianDate optional The start time of the interval. stopJulianDate optional The stop time of the interval. isStartIncludedBoolean optional trueifoptions.startis included in the interval,falseotherwise.isStopIncludedBoolean optional trueifoptions.stopis included in the interval,falseotherwise.Returns:
The first interval in the collection that matches the specified parameters. -
findIntervalContainingDate(date) → TimeInterval|undefined
-
Finds and returns the interval that contains the specified date.
Name Type Description dateJulianDate The date to search for. Returns:
The interval containing the specified date,undefinedif no such interval exists. -
get(index) → TimeInterval
-
Gets the interval at the specified index.
Name Type Description indexNumber The index of the interval to retrieve. Returns:
The interval at the specified index, orundefinedif no interval exists as that index. -
Finds and returns the index of the interval in the collection that contains the specified date.
Name Type Description dateJulianDate The date to search for. Returns:
The index of the interval that 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. -
intersect(other, dataComparer, mergeCallback) → TimeIntervalCollection
-
Creates a new instance that is the intersection of this collection and the provided collection.
Name Type Description otherTimeIntervalCollection The collection to intersect with. dataComparerTimeInterval~DataComparer optional A function which compares the data of the two intervals. If omitted, reference equality is used. mergeCallbackTimeInterval~MergeCallback optional A function which merges the data of the two intervals. If omitted, the data from the left interval will be used. Returns:
A new TimeIntervalCollection which is the intersection of this collection and the provided collection. -
Removes all intervals from the collection.
-
Removes the specified interval from this interval collection, creating a hole over the specified interval. The data property of the input interval is ignored.
Name Type Description intervalTimeInterval The interval to remove. Returns:
trueif the interval was removed,falseif no part of the interval was in the collection.
