Create a new multi-interval set containing the given labeled intervals; or empty if none
Optional
initial: IntervalSet<Label>optional initial contents of the new multi-interval set
Add a labeled interval to this set, if it is not already present and it does not conflict with existing intervals.
Labeled intervals conflict if:
For example, if this set is { "A"=[[0,10),[20,30)] },
low end of the interval, inclusive
high end of the interval, exclusive, must be greater than start
label to add
an IntervalConflictError if label is already in this set and is associated with an interval other than [start,end) that overlaps [start,end), or if an interval in this set with a different label overlaps [start,end)
Get all the intervals in this set associated with a given label, if any. The returned set has integer labels that act as indices: label 0 is associated with the lowest interval, 1 the next, and so on, for all the intervals in this set that have the provided label.
For example, if this set is { "A"=[[0,10),[20,30)], "B"=[[10,20)] },
the label
a new interval set that associates integer indices with the in-order intervals of label in this set
A mutable set of labeled intervals, where each label is associated with one or more non-overlapping half-open intervals [start, end). Neither intervals with the same label nor with different labels may overlap.
For example, { "A"=[[0,10)], "B"=[[20,30)] } is a multi-interval set where the labels are strings "A" and "B". We could add "A"=[10,20) to that set to obtain { "A"=[[0,10),[10,20)], "B"=[[20,30)] }.
Labels are of arbitrary type
Label
and are compared for equality using ===. They may not be null, undefined, or NaN*.* Note: this spec was corrected
PS2 instructions: this is a required ADT. You may not change the specifications or add new methods.