RangeSet

A range set stores a collection of Ranges in a way that makes them efficient to map and update. This is an immutable data structure.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

True when this is the empty range set.

Link copied to clipboard
val size: Int

The number of ranges in the set.

Functions

Link copied to clipboard

Return a Sequence of all Ranges in this set, in order.

Link copied to clipboard
fun between(from: DocPos, to: DocPos, f: (from: Int, to: Int, value: T) -> Boolean?)

Iterate over the ranges that touch the region from to to, calling f for each. When the callback returns false, iteration stops.

Link copied to clipboard
fun <T : RangeValue> RangeSet<T>.filter(predicate: (Range<T>) -> Boolean): RangeSet<T>

Return a new RangeSet containing only the ranges that match predicate.

Link copied to clipboard
fun <T : RangeValue> RangeSet<T>.forEach(action: (Range<T>) -> Unit)

Iterate over all ranges in this set in order, calling action for each.

Link copied to clipboard
fun iter(from: Int = 0): RangeCursor<T>

Iterate over the ranges in this set, in order, including all ranges that end at or after from.

Link copied to clipboard
fun map(changes: ChangeDesc): RangeSet<T>

Map this range set through a set of changes.

Link copied to clipboard
fun <U : T> update(updateSpec: RangeSetUpdate<U>): RangeSet<T>

Update the range set, optionally adding new ranges or filtering out existing ones.