home *** CD-ROM | disk | FTP | other *** search
/ Global Amiga Experience / globalamigaexperience.iso / compressed / development / clusterdemo.dms / clusterdemo.adf / Modules.lha / modules / txt / OSets.def < prev    next >
Text File  |  1994-05-25  |  4KB  |  141 lines

  1. |##########|
  2. |#MAGIC   #|BLOCLNFN
  3. |#PROJECT #|""
  4. |#PATHS   #|"StdProject"
  5. |#FLAGS   #|xx---x--x---xxx-----------------
  6. |#USERSW  #|--------------------------------
  7. |#USERMASK#|--------------------------------
  8. |#SWITCHES#|xx---xxxxx-xx---
  9. |##########|
  10. DEFINITION MODULE OSets;
  11.  
  12. FROM Resources IMPORT ContextPtr,NoContext;
  13.  
  14. EXCEPTION SetFull : "Set is full";
  15.  
  16.   DEFINITION MODULE GeneralSets(elem : ANYPTR);
  17.  
  18.     TYPE
  19.       Iterator  = PROCEDURE(e : elem);
  20.  
  21.       Hash      = CLASSPTR TO ARRAY OF elem;
  22.       Set       = POINTER TO SetObj;
  23.       SetObj    = OBJECT
  24.                     hash  : Hash;
  25.                     nills,
  26.                     num   : INTEGER;
  27.                     con   : ContextPtr;
  28.                     ppos  : INTEGER;
  29.  
  30.                     CONSTRUCTOR Create(con : ContextPtr := NoContext);
  31.                     DESTRUCTOR Delete;
  32.  
  33.                     METHOD Clear;
  34.  
  35.                     METHOD Include(elems : LIST OF elem);
  36.                     METHOD Exclude(elems : LIST OF elem);
  37.  
  38.                     METHOD Unite(s : Set);
  39.                     METHOD Intersect(s : Set);
  40.                     METHOD Difference(s : Set);
  41.  
  42.                     METHOD Contains(e : elem):BOOLEAN;
  43.  
  44.                     METHOD Iterate(it : Iterator);
  45.  
  46.                     METHOD Optimize;
  47.  
  48.                     METHOD Destruct;
  49.                   END;
  50.  
  51.   END GeneralSets;
  52.  
  53.   DEFINITION MODULE Sets(SetElem : POINTER TO SetElemObj);
  54.  
  55.     TYPE
  56.       SetElemObj  = OBJECT
  57.                       DESTRUCTOR Delete;
  58.                       METHOD Hash():CARDINAL;
  59.                       METHOD Equal(with : SetElem):BOOLEAN
  60.                     END;
  61.       Iterator    = PROCEDURE(e : SetElem);
  62.  
  63.       Hash        = CLASSPTR TO ARRAY OF SetElem;
  64.       Set         = POINTER TO SetObj;
  65.       SetObj      = OBJECT
  66.                       hash  : Hash;
  67.                       nills,
  68.                       num   : INTEGER;
  69.                       con   : ContextPtr;
  70.                       ppos  : INTEGER;
  71.  
  72.                       CONSTRUCTOR Create(con : ContextPtr := NoContext);
  73.                       DESTRUCTOR Delete;
  74.  
  75.                       METHOD Clear;
  76.  
  77.                       METHOD Include(elems : LIST OF SetElem);
  78.                       METHOD Exclude(elems : LIST OF SetElem);
  79.                       METHOD Filter(elems : LIST OF SetElem);
  80.  
  81.                       METHOD Unite(s : Set);
  82.                       METHOD Intersect(s : Set);
  83.                       METHOD Difference(s : Set);
  84.  
  85.                       METHOD Contains(e : SetElem):BOOLEAN;
  86.  
  87.                       METHOD Iterate(it : Iterator);
  88.  
  89.                       METHOD Optimize;
  90.  
  91.                       METHOD Destruct;
  92.                     END;
  93.  
  94.   END Sets;
  95.  
  96.   DEFINITION MODULE TrackedSets(SetElem : POINTER TO SetElemObj);
  97.  
  98.     TYPE
  99.       SetElemObj  = OBJECT
  100.                       useCount : INTEGER;
  101.  
  102.                       DESTRUCTOR Delete;
  103.                       METHOD Hash():CARDINAL;
  104.                       METHOD Equal(with : SetElem):BOOLEAN
  105.                     END;
  106.       Iterator    = PROCEDURE(e : SetElem);
  107.  
  108.       Hash        = CLASSPTR TO ARRAY OF SetElem;
  109.       Set         = POINTER TO SetObj;
  110.       SetObj      = OBJECT
  111.                       hash  : Hash;
  112.                       nills,
  113.                       num   : INTEGER;
  114.                       con   : ContextPtr;
  115.                       ppos  : INTEGER;
  116.  
  117.                       CONSTRUCTOR Create(con : ContextPtr := NoContext);
  118.                       DESTRUCTOR Delete;
  119.  
  120.                       METHOD Clear;
  121.  
  122.                       METHOD Include(elems : LIST OF SetElem);
  123.                       METHOD Exclude(elems : LIST OF SetElem);
  124.  
  125.                       METHOD Unite(s : Set);
  126.                       METHOD Intersect(s : Set);
  127.                       METHOD Difference(s : Set);
  128.  
  129.                       METHOD Contains(e : SetElem):BOOLEAN;
  130.  
  131.                       METHOD Iterate(it : Iterator);
  132.  
  133.                       METHOD Optimize;
  134.  
  135.                       METHOD Destruct;
  136.                     END;
  137.  
  138.   END TrackedSets;
  139.  
  140. END OSets.
  141.