/src/lib/storage/internal/hashed_bijective_dictionary_node.e

http://github.com/tybor/Liberty · Specman e · 103 lines · 61 code · 14 blank · 28 comment · 0 complexity · a3f7c1935700718d8c5b7a37237deacb MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. class HASHED_BIJECTIVE_DICTIONARY_NODE[V_, K_]
  5. --
  6. -- Auxiliary class to implement HASHED_BIJECTIVE_DICTIONARY.
  7. --
  8. inherit
  9. ANY_HASHED_BIJECTIVE_DICTIONARY_NODE
  10. create {HASHED_BIJECTIVE_DICTIONARY}
  11. make
  12. feature {HASHED_BIJECTIVE_DICTIONARY}
  13. val: V_
  14. key: K_
  15. next_key: like Current
  16. -- The forward link to the next `key' in case of hash-code clash.
  17. next_val: like Current
  18. -- The forward link to the next `val' in case of hash-code clash.
  19. make (v: like val; nv: like next_val; k: like key; nk: like next_key)
  20. require
  21. v /= Void
  22. k /= Void
  23. do
  24. val := v
  25. next_val := nv
  26. key := k
  27. next_key := nk
  28. ensure
  29. val = v
  30. next_val = nv
  31. key = k
  32. next_key = nk
  33. end
  34. set_val (v: like val)
  35. do
  36. val := v
  37. ensure
  38. val = v
  39. end
  40. set_next_val (nv: like next_val)
  41. do
  42. next_val := nv
  43. ensure
  44. next_val = nv
  45. end
  46. set_key (k: like key)
  47. do
  48. key := k
  49. ensure
  50. key = k
  51. end
  52. set_next_key (nk: like next_key)
  53. do
  54. next_key := nk
  55. ensure
  56. next_key = nk
  57. end
  58. set_val_and_key (v: like val; k: like key)
  59. do
  60. val := v
  61. key := k
  62. ensure
  63. val = v
  64. key = k
  65. end
  66. invariant
  67. key /= Void
  68. val /= Void
  69. end -- class HASHED_BIJECTIVE_DICTIONARY_NODE
  70. --
  71. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  72. --
  73. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  74. -- of this software and associated documentation files (the "Software"), to deal
  75. -- in the Software without restriction, including without limitation the rights
  76. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  77. -- copies of the Software, and to permit persons to whom the Software is
  78. -- furnished to do so, subject to the following conditions:
  79. --
  80. -- The above copyright notice and this permission notice shall be included in
  81. -- all copies or substantial portions of the Software.
  82. --
  83. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  84. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  85. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  86. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  87. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  88. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  89. -- THE SOFTWARE.