/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

  1. class ITERATOR_ON_AVL_DICTIONARY_KEYS[V_, K_]
  2. inherit
  3. ITERATOR[K_]
  4. insert
  5. AVL_TREE_ITERATOR[K_]
  6. create {ABSTRACT_AVL_DICTIONARY}
  7. make
  8. feature {ANY}
  9. start
  10. do
  11. if dico.root /= Void then
  12. generation := iterable_generation
  13. go_first(dico.root)
  14. end
  15. end
  16. is_off: BOOLEAN
  17. do
  18. Result := cur = Void
  19. end
  20. item: K_
  21. local
  22. node: ABSTRACT_AVL_DICTIONARY_NODE[V_, K_]
  23. do
  24. node ::= cur
  25. Result := node.key
  26. end
  27. next
  28. do
  29. go_next
  30. end
  31. feature {}
  32. make (a_dico: like dico)
  33. do
  34. dico := a_dico
  35. nodes := new_nodes
  36. start
  37. ensure
  38. dico = a_dico
  39. end
  40. dico: ABSTRACT_AVL_DICTIONARY[V_, K_]
  41. feature {ANY}
  42. iterable_generation: INTEGER
  43. do
  44. Result := dico.generation
  45. end
  46. end -- class ITERATOR_ON_AVL_DICTIONARY_KEYS