/src/lib/backtracking/internal/abstract_backtracking_poolable.e

http://github.com/tybor/Liberty · Specman e · 72 lines · 29 code · 6 blank · 37 comment · 0 complexity · ef7e7abe180a21ec78ebb06b4b8f7079 MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. deferred class ABSTRACT_BACKTRACKING_POOLABLE
  5. --
  6. -- Alternatives and sequences MUST be managed in a pool.
  7. -- The ability to be in a pool is declared in that class.
  8. --
  9. feature {ANY}
  10. release
  11. -- Called by ABSTRACT_BACKTRACKING to release
  12. -- current instance to the pool.
  13. require
  14. pool /= Void
  15. do
  16. pool.release_instance(Current)
  17. end
  18. get_twin: like Current
  19. -- Return a twin of current from the pool
  20. require
  21. pool /= Void
  22. do
  23. Result := pool.get_instance
  24. Result.copy(Current)
  25. ensure
  26. Result.is_equal(Current)
  27. end
  28. pool: ABSTRACT_BACKTRACKING_POOL[like Current]
  29. -- The pool that will record Current
  30. deferred
  31. end
  32. feature {ABSTRACT_BACKTRACKING_POOL}
  33. pool_link: ABSTRACT_BACKTRACKING_POOLABLE
  34. -- Internal link used by the pool
  35. -- to chain its poolable items.
  36. -- Technical note: to give more freedom for
  37. -- further usages of 'pool_link' it is not
  38. -- defined with type anchorage.
  39. set_pool_link (other: like pool_link)
  40. -- Set 'pool_link' to 'other'
  41. do
  42. pool_link := other
  43. ensure
  44. definition: pool_link = other
  45. end
  46. end -- class ABSTRACT_BACKTRACKING_POOLABLE
  47. --
  48. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  49. --
  50. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  51. -- of this software and associated documentation files (the "Software"), to deal
  52. -- in the Software without restriction, including without limitation the rights
  53. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  54. -- copies of the Software, and to permit persons to whom the Software is
  55. -- furnished to do so, subject to the following conditions:
  56. --
  57. -- The above copyright notice and this permission notice shall be included in
  58. -- all copies or substantial portions of the Software.
  59. --
  60. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  61. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  62. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  63. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  64. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  65. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  66. -- THE SOFTWARE.