PageRenderTime 25ms CodeModel.GetById 18ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/lib/iterator/internal/iterator_on_avl_set.e

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