/test/language/unclassified/aux_jlp8_comp_array.e

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