PageRenderTime 21ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/test/language/unclassified/aux_generic7ht.e

http://github.com/tybor/Liberty
Specman e | 108 lines | 50 code | 12 blank | 46 comment | 0 complexity | e7d408e419debd03452126b566de333b MD5 | raw file
  1-- This file is part of SmartEiffel The GNU Eiffel Compiler Tools and Libraries.
  2-- See the Copyright notice at the end of this file.
  3--
  4class AUX_GENERIC7HT[K -> HASHABLE, G]
  5
  6inherit
  7   AUX_GENERIC7XCT[G]
  8      rename item as item_for_iteration
  9      end
 10
 11insert
 12   -- *** It was an inherit in Original realease. (Vincent Croizier, 03/11/2004) ***
 13   AUX_GENERIC7LL[G]
 14      rename make as ll_make,
 15         forth as ll_forth,
 16         start as ll_start,
 17         item as item_for_iteration,
 18         has as ll_has,
 19         put as ll_put
 20      export {} ll_make, ll_forth, ll_start, ll_has, ll_put, extend
 21      end
 22
 23create {ANY}
 24   make
 25
 26feature {ANY}
 27   make (sz: INTEGER)
 28      do
 29         ll_make
 30         create keys.make
 31      end
 32
 33   put (x: G; k: K)
 34      do
 35         extend(x)
 36         keys.extend(k)
 37      end
 38      --    item(k : K): G
 39      --   local
 40      --       c: CURSOR;
 41      --   do
 42      --       from
 43      --      c := cursor;
 44      --      start;
 45      --       until
 46      --      keys.after or
 47      --          keys.item.is_equal(k)
 48      --       loop
 49      --      forth;
 50      --       end; -- loop
 51      --       if not after then
 52      --      Result := item_for_iteration;
 53      --       end;
 54      --       go_to(c);
 55      --   end; -- item
 56
 57   key_for_iteration: K
 58      do
 59         Result := keys.item
 60      end
 61
 62   forth
 63      do
 64         ll_forth
 65         keys.forth
 66      end
 67
 68   start
 69      do
 70         ll_start
 71         keys.start
 72      end
 73
 74   has (x: K): BOOLEAN
 75      do
 76         Result := keys.has(x)
 77      end
 78      --    go_to(c: CURSOR)
 79      --   do
 80      --       ll_go_to(c);
 81      --       keys.go_to(c);
 82      --   end;
 83
 84feature {}
 85   keys: AUX_GENERIC7LL[K]
 86
 87invariant
 88-- ***    same_count: keys.count = count;
 89
 90end -- class AUX_GENERIC7HT
 91--
 92-- ------------------------------------------------------------------------------------------------------------------------------
 93-- Copyright notice below. Please read.
 94--
 95-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
 96-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
 97-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
 98-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
 99-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
100-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
101--
102-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
103-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
104--
105-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
106--
107-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
108-- ------------------------------------------------------------------------------------------------------------------------------