new TimeIntervalCollection()
A non-overlapping collection of TimeIntervals sorted by start date.
See:
Members
-
changedEvent :Event
-
Gets an event that is raised whenever the collection of intervals change.
-
empty :Boolean
-
Returns true if the collection is empty, false otherwise.
-
length :Number
-
Gets the number of intervals in the collection.
-
start :JulianDate
-
Gets the start date of the collection.
-
stop :JulianDate
-
Gets the stop date of the collection.
Methods
-
addInterval(interval, equalsCallback)
-
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. equalsCallbackfunction 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. -
contains(date)
-
Returns true if the specified date is contained in the interval collection.
Name Type Description dateJulianDate The date to search for. Returns:
True if the specified date is contained in the interval collection, undefined otherwise. -
equals(right, dataComparer) → Boolean
-
Compares the provided TimeIntervalCollections and returns
trueif they are equal,falseotherwise.Name Type Description rightTimeInterval optional The right hand side collection. dataComparerfunction optional A function which compares the data for each interval in the collection. If ommitted, reference equality is used. Returns:
trueif left and right are equal,falseotherwise. -
findDataForIntervalContainingDate(date)
-
Returns the data for the interval which contains the specified date.
Name Type Description dateJulianDate The date to search for. Returns:
The data for the interval containing the specified date, or undefined if no such interval exists. -
findInterval(start, stop, isStartIncluded, isStopIncluded)
-
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.
Name Type Description startJulianDate optional The start of the interval. stopJulianDate optional The end of the interval. isStartIncludedJulianDate optional True if the start date is included. isStopIncludedJulianDate optional True if the stop date is included. Returns:
The first interval in the collection that matches the specified parameters. -
findIntervalContainingDate(date)
-
Returns the interval which contains the specified date.
Name Type Description dateJulianDate The date to search for. Returns:
The interval containing the specified date, undefined if 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 TimeInterval at the specified index, or undefined if no such index exists.Throws:
-
DeveloperError : index must be a number.
-
-
indexOf(date)
-
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 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. -
intersect(timeIntervalCollection, equalsCallback, mergeCallback)
-
Creates a new TimeIntervalCollection which is the intersection of this collection and the provided collection.
Name Type Description timeIntervalCollectionTimeIntervalCollection The collection to intersect with. equalsCallbackfunction 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. mergeCallbackfunction 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 thiscollection will be used.Returns:
A new TimeIntervalCollection which is the intersection of this collection and the provided collection. -
intersectInterval(interval, equalsCallback, mergeCallback)
-
Creates a new TimeIntervalCollection which is the intersection of this collection and the provided interval.
Name Type Description intervalTimeInterval The interval to intersect with. equalsCallbackfunction 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. mergeCallbackfunction 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 thiscollection will be used.Returns:
A new TimeIntervalCollection which is the intersection of this collection and the provided collection. -
removeAll()
-
Removes all intervals from the collection.
-
removeInterval(interval)
-
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:
true if the interval was removed, false if no part of the interval was in the collection.
