PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

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