/test/language/unclassified/aux_jlp8_epee_array.e

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