/src/lib/backtracking/node/backtracking_node_not.e

http://github.com/tybor/Liberty · Specman e · 62 lines · 23 code · 6 blank · 33 comment · 0 complexity · f574a3d290679cc01cc98a52d88435dc MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. class BACKTRACKING_NODE_NOT
  5. --
  6. -- node that negate a node what mean that the exploration
  7. -- will be continued if exploration of the subnode is stopped
  8. -- and conversely.
  9. --
  10. inherit
  11. BACKTRACKING_NODE_UNARY
  12. insert
  13. BACKTRACKING_NODE_GLOBALS
  14. create {ANY}
  15. make
  16. feature {ANY}
  17. explore (explorer: BACKTRACKING)
  18. do
  19. -- insert a cut point
  20. explorer.push_cut_point
  21. -- create a call to continuation
  22. explorer.push_or(the_true_node)
  23. -- evaluate 'node' now
  24. explorer.set_current_node(node)
  25. -- and if it's a success the following node
  26. -- will remove the or by a cut and will fail
  27. explorer.push_and(the_cut_and_false_node)
  28. end
  29. feature {}
  30. do_fill_tagged_out_memory
  31. do
  32. tagged_out_memory.append(once "not (")
  33. node.fill_tagged_out_memory
  34. tagged_out_memory.append(once ")")
  35. end
  36. end -- class BACKTRACKING_NODE_NOT
  37. --
  38. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  39. --
  40. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  41. -- of this software and associated documentation files (the "Software"), to deal
  42. -- in the Software without restriction, including without limitation the rights
  43. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44. -- copies of the Software, and to permit persons to whom the Software is
  45. -- furnished to do so, subject to the following conditions:
  46. --
  47. -- The above copyright notice and this permission notice shall be included in
  48. -- all copies or substantial portions of the Software.
  49. --
  50. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  52. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  53. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  54. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  55. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  56. -- THE SOFTWARE.