/test/language/unclassified/aux_jlp8_comp_array.e
Specman e | 60 lines | 28 code | 8 blank | 24 comment | 1 complexity | 030b4b6d9c1f5ec59eb9fe4638106ba4 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_JLP8_COMP_ARRAY[E] 5 6inherit 7 AUX_JLP8_BASIC_ARRAY[E] 8 9feature {ANY} 10 capacity: INTEGER 11 12 make (nb: INTEGER) 13 do 14 storage := storage.realloc(capacity, nb) 15 -- For NATIVE_ARRAY 16 capacity := nb 17 init(0, nb - 1) 18 end 19 20 put (elem: E; i: INTEGER) 21 do 22 storage.put(elem, i) 23 end 24 25 item (i: INTEGER): E 26 do 27 Result := storage.item(i) 28 end 29 30 resize (new_size: INTEGER) 31 do 32 if new_size > capacity then 33 storage := storage.realloc(capacity, new_size) 34 -- For NATIVE_ARRAY 35 -- storage.resize(new_size) 36 capacity := new_size 37 end 38 end 39 40 storage: NATIVE_ARRAY[E] 41 42end -- class AUX_JLP8_COMP_ARRAY 43-- 44-- ------------------------------------------------------------------------------------------------------------------------------ 45-- Copyright notice below. Please read. 46-- 47-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, 48-- as published by the Free Software Foundation; either version 2, or (at your option) any later version. 49-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty 50-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have 51-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free 52-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 53-- 54-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE 55-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE 56-- 57-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN 58-- 59-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr 60-- ------------------------------------------------------------------------------------------------------------------------------