PageRenderTime 19ms CodeModel.GetById 12ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

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