SetList
is a generic interface defining sets of Elem.T
's,
implemented as linked lists. This implementations is appropriate
only for small sets.
GENERIC INTERFACESetList (ElemSet);
WHEREElem.T
is a REF type and contains
PROCEDURE Equal(e1, e2: Elem.T): BOOLEAN;ElemSet = Set(Elem)
.
Equal
must be an equivalence relation.
Equal
may be declared with a parameter mode of eitherVALUE
orREADONLY
, but notVAR
.
TYPE Public = ElemSet.T OBJECT METHODS init(): T; END; T <: Public; Iterator <: ElemSet.Iterator;If
s
is an object of type SetDefault.T
, the expression
NEW(SetDef.T).init()creates a new, empty set.
The call s.toRefList()
returns a RefList.T
whose elements
include an element from each of the equivalence classes in
set(s)
, and no other elements.
END SetList.