/src/lib/backtracking/low_level/abstract_backtracking_cut_point.e

http://github.com/tybor/Liberty · Specman e · 64 lines · 21 code · 6 blank · 37 comment · 0 complexity · 2093d1a959486ee7f46b93d949e37c65 MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. class ABSTRACT_BACKTRACKING_CUT_POINT
  5. --
  6. -- Instances of that class are used by the ABSTRACT_BACKTRACKING
  7. -- to record "cut points" data. A cut point is an indication of
  8. -- up to which alternative are to be removed from the exploration.
  9. --
  10. -- Instances of that class are inserted in the continuation path
  11. -- to be retrieved by dynamic cast during calls to cut.
  12. --
  13. inherit
  14. ABSTRACT_BACKTRACKING_SEQUENCE
  15. rename pool as pool_of_cut_points
  16. end
  17. insert
  18. ABSTRACT_BACKTRACKING_GLOBALS
  19. feature {ABSTRACT_BACKTRACKING}
  20. top_alternative: ABSTRACT_BACKTRACKING_ALTERNATIVE
  21. -- Record of what top of the stack of alternative
  22. -- is to restore when cut is called.
  23. -- Managed by ABSTRACT_BACKTRACKING.
  24. set_top_alternative (value: like top_alternative)
  25. do
  26. top_alternative := value
  27. ensure
  28. definition: top_alternative = value
  29. end
  30. next_sequence (explorer: ABSTRACT_BACKTRACKING)
  31. -- Do nothing: remove itself (as if it were the end
  32. -- of a sequence) and evaluate the continuation by
  33. -- issuing a 'continue'.
  34. do
  35. explorer.pop_sequence
  36. explorer.continue
  37. end
  38. end -- class ABSTRACT_BACKTRACKING_CUT_POINT
  39. --
  40. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  41. --
  42. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  43. -- of this software and associated documentation files (the "Software"), to deal
  44. -- in the Software without restriction, including without limitation the rights
  45. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  46. -- copies of the Software, and to permit persons to whom the Software is
  47. -- furnished to do so, subject to the following conditions:
  48. --
  49. -- The above copyright notice and this permission notice shall be included in
  50. -- all copies or substantial portions of the Software.
  51. --
  52. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  54. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  55. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  56. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  57. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  58. -- THE SOFTWARE.