/src/lib/iterator/internal/iterator_on_linked_hashed_dictionary_items.e

http://github.com/tybor/Liberty · Specman e · 83 lines · 46 code · 13 blank · 24 comment · 0 complexity · 7617700609dc90143cdc6dea7110e0c7 MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. class ITERATOR_ON_LINKED_HASHED_DICTIONARY_ITEMS[V_, K_]
  5. -- Please do not use this class directly. Look at `ITERATOR'.
  6. inherit
  7. ITERATOR[V_]
  8. create {ANY}
  9. make
  10. feature {}
  11. node: LINKED_HASHED_DICTIONARY_NODE[V_, K_]
  12. dico: ABSTRACT_LINKED_HASHED_DICTIONARY[V_, K_]
  13. feature {ANY}
  14. make (a_dico: like dico)
  15. require
  16. a_dico /= Void
  17. do
  18. dico := a_dico
  19. start
  20. ensure
  21. dico = a_dico
  22. end
  23. start
  24. do
  25. node := dico.first_node
  26. generation := iterable_generation
  27. index := dico.lower
  28. end
  29. is_off: BOOLEAN
  30. do
  31. Result := node = Void
  32. check Result = (index > dico.upper) end
  33. end
  34. item: V_
  35. do
  36. Result := node.item
  37. end
  38. next
  39. do
  40. node := node.next_link
  41. index := index + 1
  42. end
  43. index: INTEGER
  44. feature {ANY}
  45. iterable_generation: INTEGER
  46. do
  47. Result := dico.generation
  48. end
  49. generation: INTEGER
  50. end -- class ITERATOR_ON_LINKED_HASHED_DICTIONARY_ITEMS
  51. --
  52. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  53. --
  54. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  55. -- of this software and associated documentation files (the "Software"), to deal
  56. -- in the Software without restriction, including without limitation the rights
  57. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  58. -- copies of the Software, and to permit persons to whom the Software is
  59. -- furnished to do so, subject to the following conditions:
  60. --
  61. -- The above copyright notice and this permission notice shall be included in
  62. -- all copies or substantial portions of the Software.
  63. --
  64. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  65. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  66. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  67. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  68. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  69. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  70. -- THE SOFTWARE.