|##########| |#MAGIC #|BLOCLNFN |#PROJECT #|"" |#PATHS #|"StdProject" |#FLAGS #|xx---x--x---xxx----------------- |#USERSW #|-------------------------------- |#USERMASK#|-------------------------------- |#SWITCHES#|xx---xxxxx-xx--- |##########| DEFINITION MODULE OSets; FROM Resources IMPORT ContextPtr,NoContext; EXCEPTION SetFull : "Set is full"; DEFINITION MODULE GeneralSets(elem : ANYPTR); TYPE Iterator = PROCEDURE(e : elem); Hash = CLASSPTR TO ARRAY OF elem; Set = POINTER TO SetObj; SetObj = OBJECT hash : Hash; nills, num : INTEGER; con : ContextPtr; ppos : INTEGER; CONSTRUCTOR Create(con : ContextPtr := NoContext); DESTRUCTOR Delete; METHOD Clear; METHOD Include(elems : LIST OF elem); METHOD Exclude(elems : LIST OF elem); METHOD Unite(s : Set); METHOD Intersect(s : Set); METHOD Difference(s : Set); METHOD Contains(e : elem):BOOLEAN; METHOD Iterate(it : Iterator); METHOD Optimize; METHOD Destruct; END; END GeneralSets; DEFINITION MODULE Sets(SetElem : POINTER TO SetElemObj); TYPE SetElemObj = OBJECT DESTRUCTOR Delete; METHOD Hash():CARDINAL; METHOD Equal(with : SetElem):BOOLEAN END; Iterator = PROCEDURE(e : SetElem); Hash = CLASSPTR TO ARRAY OF SetElem; Set = POINTER TO SetObj; SetObj = OBJECT hash : Hash; nills, num : INTEGER; con : ContextPtr; ppos : INTEGER; CONSTRUCTOR Create(con : ContextPtr := NoContext); DESTRUCTOR Delete; METHOD Clear; METHOD Include(elems : LIST OF SetElem); METHOD Exclude(elems : LIST OF SetElem); METHOD Filter(elems : LIST OF SetElem); METHOD Unite(s : Set); METHOD Intersect(s : Set); METHOD Difference(s : Set); METHOD Contains(e : SetElem):BOOLEAN; METHOD Iterate(it : Iterator); METHOD Optimize; METHOD Destruct; END; END Sets; DEFINITION MODULE TrackedSets(SetElem : POINTER TO SetElemObj); TYPE SetElemObj = OBJECT useCount : INTEGER; DESTRUCTOR Delete; METHOD Hash():CARDINAL; METHOD Equal(with : SetElem):BOOLEAN END; Iterator = PROCEDURE(e : SetElem); Hash = CLASSPTR TO ARRAY OF SetElem; Set = POINTER TO SetObj; SetObj = OBJECT hash : Hash; nills, num : INTEGER; con : ContextPtr; ppos : INTEGER; CONSTRUCTOR Create(con : ContextPtr := NoContext); DESTRUCTOR Delete; METHOD Clear; METHOD Include(elems : LIST OF SetElem); METHOD Exclude(elems : LIST OF SetElem); METHOD Unite(s : Set); METHOD Intersect(s : Set); METHOD Difference(s : Set); METHOD Contains(e : SetElem):BOOLEAN; METHOD Iterate(it : Iterator); METHOD Optimize; METHOD Destruct; END; END TrackedSets; END OSets.