PageRenderTime 21ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/test/language/unclassified/aux_generic6ht.e

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