sparql-view-unfold
    Preparing search index...

    A union-find over values, grouping the ones that have to be equal. Complexity: n*log(n).

    Allegedly this can be compressed down to O(invAckerman(n)): https://claude.ai/share/8db9c2e2-918f-42ed-af83-e5564a6f80a3

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    cleanNumber: number

    Counter for generating unique group IDs

    groupToValues: Record<number, T[]>

    Maps group ID to the values in it - read through valuesOf and groupEntries.

    revisionStamp: number

    The stamp revision reports - read through it, and moved on by touch.

    toId: (value: T) => string
    valueToGroup: Record<string, number | undefined>

    Maps a value to the group it is in - read through groupOf.

    Accessors

    • get revision(): number

      The state the set is in, as a stamp that no two states of any two sets share.

      Every method that writes anything moves it on (touch), so a memo taken off the set is valid for exactly as long as this is what it was taken at - which is a check the memo cannot forget to make, there being nothing to invalidate.

      Returns number

    Methods

    • Whether the group holds something its single remaining member would still be constrained by.

      Parameters

      • _group: number

        The group to check

      Returns boolean

      whether it does; never at this level

    • Deletes a group and every value in it, which subclasses extend with the state they add.

      Parameters

      • group: number

        The group to drop

      Returns void

    • Gets or creates a group for a value.

      Parameters

      • value: T

        The value to get/create a group for

      Returns number

      the group ID

    • Every group and its values, in the order the groups were created.

      Returns [number, readonly T[]][]

      the pairs

    • The group a value is in, without creating one for it - the read-only counterpart of getGroup.

      Parameters

      • value: T

        The value to look up

      Returns number | undefined

      the group ID, or undefined when the value is in no group

    • Whether the group exists at all - a group nothing points at any more does not.

      Parameters

      • group: number

        The group to check

      Returns boolean

      whether it exists

    • Whether the group is still worth keeping: two members constrain each other, and a single one is constrained by whatever the group carriesInformation about.

      Parameters

      • group: number

        The group to check

      Returns boolean

      whether it is worth keeping; a subclass that lets something outside the group's values point at it overrides this, dropping such a group leaving that reference dangling

    • Merges two groups by id, which is what a group nothing names can be merged by - the values-only half of a merge, whatever else a subclass hangs off a group being migrated by migrateGroupData.

      Parameters

      • fromGroup: number

        One group

      • toGroup: number

        The other

      Returns { newGroup: number; oldGroup: number } | undefined

      the ids involved, or undefined when the two ids are the same group

    • Merges the groups of two values into one.

      Parameters

      • from: T

        One of the values

      • to: T

        The other

      Returns { newGroup: number; oldGroup: number } | undefined

      the ids involved, or undefined when both values were already in the same group

    • Moves everything the disappearing group carried besides its values onto the surviving one. Subclasses that give a group more state migrate it here, calling super first so that whatever a class further up carries over is already in place.

      Parameters

      • _oldGroup: number

        The group disappearing

      • _newGroup: number

        The group surviving

      Returns void

    • Takes a value out of the group it is in, dropping the group when it no longer says anything (isLive).

      Parameters

      • value: T

        The value to remove

      Returns void

    • The values of a group.

      Parameters

      • group: number

        The group to read

      Returns readonly T[]

      its values, empty when the group does not exist