/** @packageDocumentation
 * @module Ids
 */
import { Id64Array, Id64Set, Id64String } from "./Id";
import { OrderedId64Iterable } from "./OrderedId64Iterable";
import { SortedArray } from "./SortedArray";
/** @public */
export type CompressedId64Set = string;
/** A compact string representation of an [[Id64Set]]. Such a representation is useful when serializing potentially very large
 * sets of Ids.
 * @see [[CompressedId64Set.iterable]] to efficiently iterate the Ids represented by a compact string.
 * @see [[CompressedId64Set.compressSet]] and [[CompressedId64Set.compressArray]] to produce a compact string from a collection of Ids.
 * @see [[CompressedId64Set.decompressSet]] and [[CompressedId64Set.decompressArray]] to produce a collection of Ids from a compact string.
 * @see [[OrderedId64Iterable]] for a generic representation of an ordered set of Ids (compressed or otherwise).
 * @see [[MutableCompressedId64Set]] for a mutable version.
 * @public
 */
export declare namespace CompressedId64Set {
    /** Given a set of [[Id64String]]s, produce a compact string representation. Useful when serializing potentially large sets of Ids.
     * @note Invalid Ids are ignored.
     * @see [[CompressedId64Set.sortAndCompress]] to compress any unordered collection of Ids.
     * @see [[CompressedId64Set.compressArray]] to perform the same operation on an [[Id64Array]].
     * @see [[CompressedId64Set.decompressSet]] to perform the inverse operation.
     */
    function compressSet(ids: Id64Set): CompressedId64Set;
    /** Create a sorted array from `ids`, then return a compact string representation of those Ids.
     * @see [[CompressedId64Set.compressIds]] if `ids` is known to already be sorted.
     */
    function sortAndCompress(ids: Iterable<Id64String>): CompressedId64Set;
    /** Give a **numerically-ordered** array of [[Id64String]]s, produce a compact string representation. Useful when serializing potentially large sets of Ids.
     * Duplicate Ids are included only once in the string representation.
     * @throws Error if two consecutive Ids `x` and `y` exist such that the numerical value of `x` is greater than that of `y` - i.e., the array is not properly sorted.
     * @note The array must be sorted according to the 64-bit numerical value of each Id.
     * @note Invalid Ids are ignored.
     * @see [[CompressedId64Set.decompressArray]] to perform the inverse operation.
     * @see [[OrderedId64Iterable.sortArray]] to ensure the Ids are properly sorted.
     * @see [[CompressedId64Set.sortAndCompress]] to compress any unordered collection of Ids.
     */
    function compressArray(ids: Id64Array): CompressedId64Set;
    /** Give a **numerically-ordered** collection of [[Id64String]]s, produce a compact string representation. Useful when serializing potentially large sets of Ids.
     * Duplicate Ids are included only once in the string representation.
     * @throws Error if two consecutive Ids `x` and `y` exist such that the numerical value of `x` is greater than that of `y` - i.e., the collection is not properly sorted.
     * @note The collection must be sorted according to the 64-bit numerical value of each Id.
     * @note Invalid Ids are ignored.
     * @see [[CompressedId64Set.iterable]] to perform the inverse operation.
     * @see [[OrderedId64Iterable.sortArray]] or [[OrderedId64Iterable.compare]] to ensure the Ids are properly sorted.
     * @see [[CompressedId64Set.sortAndCompress]] to compress any unordered collection of Ids.
     */
    function compressIds(ids: OrderedId64Iterable): CompressedId64Set;
    /** Supplies an iterator over the [[Id64String]]s in a [[CompressedId64Set]].
     * The Ids are iterated in ascending order based on their unsigned 64-bit integer values.
     */
    function iterator(ids: CompressedId64Set): Iterator<Id64String>;
    /** Supplies an iterable over the [[Id64String]]s in a [[CompressedId64Set]].
     * The Ids are iterated in ascending order based on their unsigned 64-bit integer values.
     */
    function iterable(ids: CompressedId64Set): OrderedId64Iterable;
    /** Decompress the compact string representation of an [[Id64Set]] into an [[Id64Set]].
     * @param compressedIds The compact string representation.
     * @param out If supplied, the Ids will be inserted into this set rather than allocating and returning a new set.
     * @returns The set containing the decompressed Ids.
     * @throws Error if `compressedIds` is not a well-formed [[CompressedId64Set]].
     * @see [[CompressedId64Set.compressSet]] to perform the inverse operation.
     * @see [[CompressedId64Set.decompressArray]] to decompress as an [[Id64Array]] instead.
     * @see [[CompressedId64Set.iterable]] to efficiently iterate the Ids.
     */
    function decompressSet(compressedIds: CompressedId64Set, out?: Id64Set): Id64Set;
    /** Decompress the compact string representation of an [[Id64Set]] into an [[Id64Array]].
     * @param compressedIds The compact string representation.
     * @param out If supplied, the Ids will be appended to this array rather than allocating and returning a new array.
     * @returns The array containing the decompressed Ids.
     * @throws Error if `compressedIds` is not a well-formed [[CompressedId64Set]].
     * @note The Ids are decompressed and appended to the array in ascending order based on their 64-bit numerical values.
     * @see [[CompressedId64Set.compressArray]] to perform the inverse operation.
     * @see [[CompressedId64Set.decompressSet]] to decompress as an [[Id64Set]] instead.
     * @see [[CompressedId64Set.iterable]] to efficiently iterate the Ids.
     */
    function decompressArray(compressedIds: CompressedId64Set, out?: Id64Array): Id64Array;
}
/** A [[SortedArray]] of unique [[Id64String]]s sorted in ascending order by the 64-bit unsigned integer values of the Ids.
 * @see [[CompressedId64Set]] for an immutable compact string representation.
 * @public
 */
export declare class OrderedId64Array extends SortedArray<Id64String> {
    /** Construct a new, empty array. */
    constructor();
    /** An iterable that iterates over the Ids in sorted order. */
    get ids(): OrderedId64Iterable;
    /** The underlying array of Ids. */
    get array(): ReadonlyArray<Id64String>;
}
/** A mutable set of valid [[Id64String]]s sorted in ascending order by the 64-bit unsigned integer value of the Ids.
 * Internally the set of Ids is maintained as a [[CompressedId64Set]] string representation.
 * Insertions and removals are buffered until the string representation needs to be recomputed. The string representation is recomputed by every public method except [[add]] and [[delete]] -
 * therefore, if multiple removals and/or insertions are required, it is most efficient to perform them all before invoking other methods.
 * @public
 */
export declare class MutableCompressedId64Set implements OrderedId64Iterable {
    private _ids;
    private readonly _inserted;
    private readonly _deleted;
    /** Construct a new set, optionally initialized to contain the Ids represented by `ids`. */
    constructor(ids?: CompressedId64Set);
    /** Obtain the compact string representation of the contents of this set. If any insertions or removals are pending, they will be applied and the string recomputed. */
    get ids(): CompressedId64Set;
    /** Add the specified Id to the set.
     * @throws Error if `id` is not a valid [[Id64String]].
     */
    add(id: Id64String): void;
    /** Remove the specified Id from the set.
     * @throws Error if `id` is not a valid [[Id64String]].
     */
    delete(id: Id64String): void;
    /** Remove all Ids from the set. */
    clear(): void;
    /** Remove all Ids from the set, then add the specified Ids. */
    reset(ids?: CompressedId64Set): void;
    /** Obtain an iterator over the Ids in this set. The Ids are returned in ascending order based on their unsigned 64-bit integer values. */
    [Symbol.iterator](): Iterator<string, any, any>;
    /** Compute a compact string representation of the union of this and another set of Ids - i.e., those Ids present in either this and/or the other set. */
    computeUnion(ids: OrderedId64Iterable | CompressedId64Set | MutableCompressedId64Set): CompressedId64Set;
    /** Compute a compact string representation of the intersection of this and another set of Ids - i.e., those Ids present in both this and the other set. */
    computeIntersection(ids: OrderedId64Iterable | CompressedId64Set | MutableCompressedId64Set): CompressedId64Set;
    /** Compute a compact string representation of the difference between this and another set - i.e., those Ids present in this but not in the other set. */
    computeDifference(ids: OrderedId64Iterable | CompressedId64Set | MutableCompressedId64Set): CompressedId64Set;
    /** Return true if this set contains no Ids. */
    get isEmpty(): boolean;
    /** Return true if the set of Ids represented by `other` is identical to those in this set.
     * @note This considers only the **distinct** Ids in `other` - duplicates are ignored.
     */
    equals(other: CompressedId64Set | MutableCompressedId64Set | OrderedId64Iterable): boolean;
    private get _isDirty();
    private updateIds;
}
//# sourceMappingURL=CompressedId64Set.d.ts.map