ProtectedcleanCounter for generating unique group IDs
ProtectedgroupA history of oldGroups (keys) that got merged into newGroups (values). Needed to dereference removed groups still used in a pin.
ProtectedgroupMaps group ID to the part of its range a condition asserted, rather than the set working it out
ProtectedgroupMaps group ID to what the group is pinned to (if anything) - read through pinOf.
ProtectedgroupMaps group ID to the term types its value may have - read through rangeOf.
ProtectedgroupMaps group ID to the values in it - read through valuesOf and groupEntries.
Protected ReadonlymeetMeets the two pins a group is asked to carry at once, reporting false when no value
satisfies both
Protected ReadonlytoProtectedvalueMaps a value to the group it is in - read through groupOf.
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.
Narrows the group's range with something a condition asserts of it, which assertedRangeOf reports back and everything else treats as an ordinary narrowing.
The group to narrow
The term types the condition asserts its value has
false when nothing is left for it to be, or when its pin is not one of those terms
Gives a group the shape of a triple term, creating an anonymous group per position where it has none.
The group to shape
the group per position, or false when the group cannot hold a triple term
ProtectedcarriesA group a condition narrowed the range of carries information however few members it has: what it was
told is what its last member is still constrained by, and what utils/assertionConjunction!AssertionConjunction.get reads back out of it as T⟨?x : τ⟩.
Without this the whole of FILTER(isTRIPLE(?x)) would be dropped the moment its group falls to one
member - which the transfer through a BIND(?y AS ?x) does at once, ?x leaving the group it just
put ?y in - and a condition dropped from Θ is a condition dropped from the query.
The group to check
whether it is worth keeping
The positions of the shape a group is pinned to.
The group to look up
the group per position, or undefined when it is not pinned to a shape
Resets the set to its initial state, dropping every group.
A copy that shares no state with this one.
Overridden rather than inherited: TermClusterSet.clone builds a set of its class, which would leave the asserted ranges behind on every clone the conjunction takes.
the copy
ProtectedcopyCopies the state of this set into target, which subclasses extend with the state they add.
The set to copy into
ProtectedcreateCreates a group holding no values at all, which is only reachable through whatever a subclass makes point at it - the positions of a triple pin, for datastructures/TermClusterSet!TermClusterSet.
the new group
ProtectedcreateCreates a group holding one value.
The value to hold
the new group
ProtecteddropDeletes a group and every value in it, which subclasses extend with the state they add.
The group to drop
Gets or creates a group for a value.
The value to get/create a group for
the group ID
Every group and its values, in the order the groups were created.
the pairs
The group a value is in, without creating one for it - the read-only counterpart of getGroup.
The value to look up
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.
The group to check
whether it exists
ProtectedisA group a live pin points at survives however few members it has: it is a position of a shape, and dropping it would leave that shape naming a group that is no longer there.
The group to check
whether it is worth keeping
ProtectedmergeMerges 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.
One group
The other
the ids involved, or undefined when the two ids are the same group
Merges two groups, carrying over everything the disappearing one held.
One of the values whose group to merge
The other
the ids involved and whether the two could not hold the same value, which leaves the set in a
state no caller may read - what to do about that is up to the two subclasses; undefined when both
values were already in one group
ProtectedmigrateCarries the asserted range of the disappearing group over: both groups hold one value, so it is asserted of that value whichever of them it was asserted of.
The group disappearing
The group surviving
Narrows what terms a group's value may have.
The group to narrow
The term types to narrow it to
false when nothing is left for it to be, or when its pin is not one of those terms
The pin of a group.
The group to look up
what it is pinned to, or undefined when nothing fixes its value
The term types a group's value may have.
The group to look up
its range, the top of the lattice when nothing narrowed it
Takes a value out of the group it is in, dropping the group when it no longer says anything (isLive).
The value to remove
Dereferences a group id through the merge history.
The id to resolve
the group it has become, or itself when it is still its own group
Pins a term onto a group.
The group to pin
The term every value of it equals
false when the group already carries something incompatible, which leaves the set in a state
no caller may read
The term a group is pinned to.
The group to look up
the term, or undefined when nothing pins it, or a shape does instead
ProtectedtouchMoves revision on, invalidating whatever was memoised off the state the set was just in.
Called by the method that writes rather than by whoever asked for the write, so that a caller has
nothing to remember. Most of the calls sit on the choke points the writes of this class pass through -
clear, copyInto, createEmptyGroup, remove, dropGroup,
mergeGroupIds - which is what a subclass extending one of them inherits rather than has to
repeat, and what makes createGroup and every super-chaining override safe without a call of their
own.
A subclass writing state no ancestor writes owes a call here on its own account, since no choke
point of this class covers it. Those are narrowRange and resolveAllConstraints on
datastructures/TermClusterSet!TermClusterSet, assertTermTypeRange on
datastructures/AssertionClusterSet!AssertionClusterSet, and sortClusters,
registerExpressionToGroup and the static-validation branch of register on ClusterSolver!ClusterSolver
Unifies two groups by id - the merge mergeGroups is, for the groups no value names.
One group
The other
false when the two cannot hold the same value
The values of a group.
The group to read
its values, empty when the group does not exist
The TermClusterSet an utils/assertionConjunction!AssertionConjunction is built on: groups of RDF terms, meeting pins the way a conjunction of
sameTermconditions needs them met, and remembering which part of a group's range it was told rather than worked out.That last part is here rather than in TermClusterSet because it is not a fact about groups at all
The two are kept in step by assertTermTypeRange narrowing both, which gives the invariant everything else relies on: the asserted range always contains the effective one. So the asserted half never decides anything the effective half does not.