Import std.collections.interval_tree
IntervalTree
class
@DebugElements Public Class IntervalTree<K: Comparable, V> Implements Iterable<(K, K, V)>, Cloneable, Defaultable
Values over ranges of keys, found by the ranges that hold a key or overlap another range.
Examples
Local meetings = IntervalTree<Int, String>()
meetings.Add(9, 11, "standup")
meetings.Add(10, 12, "review")
meetings.Add(14, 15, "lunch")
Expect(meetings.Containing(10).Count == 2)
Expect(meetings.Overlapping(12, 13) == [(10, 12, "review")])std/collections/interval_tree.fb, line 42
-
How many values it has, over all its intervals.
-
Adds a value over the interval from
lowtohigh, after any others over it. A high belowlowpanics, and so does an end that isn't equal to itself, like NaN. -
Removes the first
valueover the interval fromlowtohighthat's equal tovalue, and tells whether there was one. An end that isn't equal to itself has none. -
Whether a value equal to
valueis over the interval fromlowtohigh, which an end that isn't equal to itself never has. -
Takes every interval out.
-
The intervals that overlap the one from
lowtohigh, with their values, bylowand then byhigh, in a new array. A high belowlowoverlaps nothing, and so does an end that isn't equal to itself. -
The intervals that hold
key, with their values, by low and then by high, in a new array. -
Each interval's low and high with each of its values, by low and then by high, in a new array.
-
A new, empty IntervalTree.
-
A new IntervalTree with the same intervals and values.
-
Each interval's low and high with each of its values, as a tuple, by low and then by high. Adding or removing a value while going over them panics.
Report an issue with this page or with FutureBlitz on GitHub.