home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / SmallEiffel 0.3.3 / SmallEiffel 68k / lib_test / aux_generic7ht.e < prev    next >
Encoding:
Text File  |  1996-06-13  |  1.4 KB  |  102 lines  |  [TEXT/EDIT]

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class AUX_GENERIC7HT [K -> HASHABLE,G]
  5.  
  6. inherit
  7.     AUX_GENERIC7XCT[G]
  8.     rename
  9.         item as item_for_iteration
  10.     end;
  11.     AUX_GENERIC7LL[G]
  12.     rename
  13.         make as ll_make,
  14.         forth as ll_forth,
  15.         start as ll_start,
  16.         item as item_for_iteration,
  17.         has as ll_has,
  18.         go_to as ll_go_to,
  19.         put as ll_put
  20.     export {NONE}
  21.         ll_make,
  22.         ll_forth,
  23.         ll_start,
  24.         ll_has,
  25.         ll_go_to,
  26.         ll_put,
  27.         extend
  28.     end;
  29.  
  30. creation make
  31.  
  32. feature
  33.  
  34.     make(sz: INTEGER) is
  35.     do
  36.         ll_make;
  37.         !!keys.make;
  38.     end;
  39.  
  40.     put(x: G; k: K) is
  41.     do
  42.         extend(x);
  43.         keys.extend(k);
  44.     end; -- put
  45.  
  46.     item(k : K): G is
  47.     local
  48.         c: CURSOR;
  49.     do
  50.         from
  51.         c := cursor;
  52.         start;
  53.         until
  54.         keys.after or
  55.             keys.item.is_equal(k)
  56.         loop
  57.         forth;
  58.         end; -- loop
  59.         if not after then
  60.         Result := item_for_iteration;
  61.         end;
  62.         go_to(c);
  63.     end; -- item
  64.  
  65.     key_for_iteration: K is
  66.     do
  67.         Result := keys.item;
  68.     end;
  69.  
  70.     forth is
  71.     do
  72.         ll_forth;
  73.         keys.forth;
  74.     end; -- forth
  75.  
  76.     start is
  77.     do
  78.         ll_start;
  79.         keys.start;
  80.     end; -- start
  81.  
  82.     has (x: K): BOOLEAN is
  83.     do
  84.         Result := keys.has(x);
  85.     end;
  86.  
  87.     go_to(c: CURSOR) is
  88.     do
  89.         ll_go_to(c);
  90.         keys.go_to(c);
  91.     end;
  92.  
  93. feature {NONE}
  94.  
  95.     keys: AUX_GENERIC7LL[K];
  96.  
  97. invariant
  98.  
  99.     same_count: keys.count = count;
  100.  
  101. end  -- AUX_GENERIC7HT
  102.