PageRenderTime 21ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/lib/iterator/internal/iterator_on_avl_dictionary_items.e

http://github.com/tybor/Liberty
Specman e | 57 lines | 46 code | 11 blank | 0 comment | 1 complexity | f6af40a20421c2ed5c3e979c1fb331c5 MD5 | raw file
 1class ITERATOR_ON_AVL_DICTIONARY_ITEMS[V_, K_]
 2
 3inherit
 4   ITERATOR[V_]
 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            go_first(dico.root)
17            generation := iterable_generation
18         end
19      end
20
21   is_off: BOOLEAN
22      do
23         Result := cur = Void
24      end
25
26   item: V_
27      local
28         node: ABSTRACT_AVL_DICTIONARY_NODE[V_, K_]
29      do
30         node ::= cur
31         Result := node.value
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_ITEMS