set/src/SetList.ig


Copyright (C) 1994, Digital Equipment Corp.
SetList is a generic interface defining sets of Elem.T's, implemented as linked lists. This implementations is appropriate only for small sets.

GENERIC INTERFACE SetList(ElemSet);
WHERE Elem.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 either VALUE or READONLY, but not VAR.


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.