PageRenderTime 15ms CodeModel.GetById 12ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/lib/iterator/internal/iterator_on_linked_hashed_dictionary_keys.e

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