/src/lib/storage/set/ext_avl_set.e

http://github.com/tybor/Liberty · Specman e · 74 lines · 42 code · 9 blank · 23 comment · 0 complexity · 146eb576a44001c9b58f119e1b5da70f MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. class EXT_AVL_SET[E_]
  5. inherit
  6. ABSTRACT_AVL_SET[E_]
  7. rename
  8. make as abs_make,
  9. from_collection as abs_from_collection
  10. end
  11. create {ANY}
  12. make, from_collection
  13. feature {ANY}
  14. order: PREDICATE[TUPLE[E_, E_]]
  15. from_collection (a_order: like order; model: COLLECTION[like item])
  16. require
  17. a_order /= Void
  18. model /= Void
  19. do
  20. order := a_order
  21. abs_from_collection(model)
  22. ensure
  23. order = a_order
  24. end
  25. feature {}
  26. ordered (e1, e2: E_): BOOLEAN
  27. do
  28. Result := order.item([e1, e2])
  29. end
  30. a_new_node: EXT_AVL_SET_NODE[E_]
  31. do
  32. create Result.make(order)
  33. end
  34. make (a_order: like order)
  35. require
  36. a_order /= Void
  37. do
  38. order := a_order
  39. abs_make
  40. ensure
  41. order = a_order
  42. end
  43. invariant
  44. order /= Void
  45. end -- class EXT_AVL_SET
  46. --
  47. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  48. --
  49. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  50. -- of this software and associated documentation files (the "Software"), to deal
  51. -- in the Software without restriction, including without limitation the rights
  52. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  53. -- copies of the Software, and to permit persons to whom the Software is
  54. -- furnished to do so, subject to the following conditions:
  55. --
  56. -- The above copyright notice and this permission notice shall be included in
  57. -- all copies or substantial portions of the Software.
  58. --
  59. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  60. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  61. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  62. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  63. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  64. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  65. -- THE SOFTWARE.