as iswithout express or implied warranty. Export of this software outside of the United States of America may require an export license.
T represents an equivalence relation on the set of all
A newly created
Default has each
Elem.T in its own equivalence
Elem is expected to have the following declaration:
PROCEDURE Equal(e1, e2: Elem.T): BOOLEAN;which defines the a priori equality of two elements.
Default implementation (union-find with path compression using
hash tables) also expects an
TYPE T = OBJECT METHODS equal(e1, e2: Elem.T): BOOLEAN;
e2members of the same equivalence class?
identify(e1, e2: Elem.T): BOOLEAN;
join the two equivalence classes represented by
TRUEiff they are already equal.
canon(e: Elem.T): Elem.T;
return the canonical representative of the class containing
For each element which is not its own canonical representative, obtain that element as
alias, and its canonical representative as
END; Iterator = OBJECT METHODS next(VAR alias, canon: Elem.T): BOOLEAN; END; Default <: T OBJECT METHODS init(sizeHint: CARDINAL := 0; leaderPreference: Preference := NIL): Default; END; Preference = OBJECT METHODS is(thisBetter, thanThis: Elem.T): BOOLEAN; END; END Equivalence.