PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/src/lib/iterator/internal/iterator_on_bijective_dictionary_keys.e

http://github.com/tybor/Liberty
Specman e | 79 lines | 42 code | 12 blank | 25 comment | 0 complexity | 4c8e9365fe9d06876236d6b4d4995b91 MD5 | raw file
 1-- This file is part of a Liberty Eiffel library.
 2-- See the full copyright at the end.
 3--
 4class ITERATOR_ON_BIJECTIVE_DICTIONARY_KEYS[V_, K_]
 5   -- Please do not use this class directly. Look at `ITERATOR'.
 6
 7inherit
 8   ITERATOR[K_]
 9
10create {ANY}
11   make
12
13feature {}
14   bijective_dictionary: BIJECTIVE_DICTIONARY[V_, K_]
15         -- The one to be traversed.
16
17   item_index: INTEGER
18
19feature {ANY}
20   make (d: like bijective_dictionary)
21      require
22         d /= Void
23      do
24         bijective_dictionary := d
25         start
26      ensure
27         bijective_dictionary = d
28      end
29
30   start
31      do
32         item_index := 1
33         generation := iterable_generation
34      end
35
36   is_off: BOOLEAN
37      do
38         Result := item_index > bijective_dictionary.count
39      end
40
41   item: K_
42      do
43         Result := bijective_dictionary.key(item_index)
44      end
45
46   next
47      do
48         item_index := item_index + 1
49      end
50
51feature {ANY}
52   iterable_generation: INTEGER
53      do
54         Result := bijective_dictionary.generation
55      end
56
57   generation: INTEGER
58
59end -- class ITERATOR_ON_BIJECTIVE_DICTIONARY_KEYS
60--
61-- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
62--
63-- Permission is hereby granted, free of charge, to any person obtaining a copy
64-- of this software and associated documentation files (the "Software"), to deal
65-- in the Software without restriction, including without limitation the rights
66-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
67-- copies of the Software, and to permit persons to whom the Software is
68-- furnished to do so, subject to the following conditions:
69--
70-- The above copyright notice and this permission notice shall be included in
71-- all copies or substantial portions of the Software.
72--
73-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
74-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
75-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
76-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
77-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
78-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
79-- THE SOFTWARE.