* Adds the interval `(open, close)`. One that opens before the last one * added, or crosses one that holds it, is refused (false).
(open: number, close: number, value: T)
| 36 | * added, or crosses one that holds it, is refused (false). |
| 37 | */ |
| 38 | add(open: number, close: number, value: T): boolean { |
| 39 | const count = this.opens.length; |
| 40 | if (close <= open || (count > 0 && open <= this.opens[count - 1]!)) return false; |
| 41 | const parent = this.innermost(open); |
| 42 | if (parent >= 0 && close >= this.closes[parent]!) return false; |
| 43 | this.opens.push(open); |
| 44 | this.closes.push(close); |
| 45 | this.parents.push(parent); |
| 46 | this.values.push(value); |
| 47 | return true; |
| 48 | } |
| 49 | |
| 50 | /** The values of the intervals holding `offset` (open < offset < close), outermost first. */ |
| 51 | at(offset: number): T[] { |
no test coverage detected