PageRenderTime 19ms CodeModel.GetById 17ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/src/lib/iterator/internal/iterator_on_avl_dictionary_keys.e

http://github.com/tybor/Liberty
Specman e | 57 lines | 46 code | 11 blank | 0 comment | 1 complexity | ab35eb804efa2ea01e75981fc5b23a28 MD5 | raw file
 1class ITERATOR_ON_AVL_DICTIONARY_KEYS[V_, K_]
 2
 3inherit
 4   ITERATOR[K_]
 5
 6insert
 7   AVL_TREE_ITERATOR[K_]
 8
 9create {ABSTRACT_AVL_DICTIONARY}
10   make
11
12feature {ANY}
13   start
14      do
15         if dico.root /= Void then
16            generation := iterable_generation
17            go_first(dico.root)
18         end
19      end
20
21   is_off: BOOLEAN
22      do
23         Result := cur = Void
24      end
25
26   item: K_
27      local
28         node: ABSTRACT_AVL_DICTIONARY_NODE[V_, K_]
29      do
30         node ::= cur
31         Result := node.key
32      end
33
34   next
35      do
36         go_next
37      end
38
39feature {}
40   make (a_dico: like dico)
41      do
42         dico := a_dico
43         nodes := new_nodes
44         start
45      ensure
46         dico = a_dico
47      end
48
49   dico: ABSTRACT_AVL_DICTIONARY[V_, K_]
50
51feature {ANY}
52   iterable_generation: INTEGER
53      do
54         Result := dico.generation
55      end
56
57end -- class ITERATOR_ON_AVL_DICTIONARY_KEYS