SetDef is a generic interface defining sets of Elem.T's,
implemented via hash tables.
GENERIC INTERFACESetDef (ElemSet);
WHEREElemSet = Set(Elem), andElem.Tis a type that is not an open array type andElemcontains
PROCEDURE Equal(e1, e2: Elem.T): BOOLEAN; PROCEDURE Hash(k: Key.T): Word.T;Equalmust be an equivalence relation andHashmust respect that equivalence relation, i.e., ifEqual(k1, k2), thenHash(k1)=Hash(k2).
HashandEqualmay be declared with a parameter mode of eitherVALUEorREADONLY, but notVAR.
TYPE
Public = ElemSet.T OBJECT METHODS
init(sizeHint: CARDINAL := 0): T
END;
T <: Public;
Iterator <: ElemSet.Iterator;
The expression
NEW(SetDef.T).init(sz)
creates a new, empty set. The argument sz is a hint; the set may
be more efficient if sz accurately predicts the maximum number of
elements it will ever contain.
END SetDef.