/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import { SortedSet } from "@fluidframework/merge-tree/internal"; import type { SequenceInterval } from "../intervals/index.js"; /** * A set of intervals ordered by their end position, then by interval ID. * * The ID is included so that the ordering is total. Without it, distinct intervals sharing an * end position would compare equal, and a set cannot store or remove entries it cannot tell apart. * * Queries, however, must not consider the ID. Every query here is expressed in terms of a * position, and is answered by locating the boundaries of the run of intervals sharing that end * position via {@link SequenceIntervalEndSet.lowerBound} and * {@link SequenceIntervalEndSet.upperBound}, which compare end positions alone. This is well * defined precisely because the set is ordered by end position first. It also means callers can * probe with a transient interval whose ID is arbitrary, which matters because * `createTransientIntervalFromSequence` assigns transients a freshly generated ID. */ export declare class SequenceIntervalEndSet extends SortedSet { protected compare(a: SequenceInterval, b: SequenceInterval): number; /** * Binary searches for the point where `matches` starts holding. It must be false for some * (possibly empty) run of intervals at the front of the set and true for all the rest, which * holds for any predicate keyed on end position. * * @returns the index of the first interval `matches` accepts, or this set's size if it * accepts none. */ private firstIndexWhere; /** * Binary searches on end position alone, ignoring IDs. * * @returns the index of the first interval whose end is not before `probe`'s. */ private lowerBound; /** * Binary searches on end position alone, ignoring IDs. * * @returns the index of the first interval whose end is after `probe`'s. */ private upperBound; /** * Finds the floor of `probe` by end position. * * @returns the interval with the greatest end at or before `probe`'s, if any. */ lastAtOrBefore(probe: SequenceInterval): SequenceInterval | undefined; /** * Finds the ceiling of `probe` by end position. * * @returns the interval with the least end at or after `probe`'s, if any. */ firstAtOrAfter(probe: SequenceInterval): SequenceInterval | undefined; } //# sourceMappingURL=sequenceIntervalEndSet.d.ts.map