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

/src/lib/backtracking/low_level/abstract_backtracking_sequence.e

http://github.com/tybor/Liberty
Specman e | 77 lines | 24 code | 6 blank | 47 comment | 0 complexity | 89340fea4bd53fbacfbe5e30d0471248 MD5 | raw file
 1-- This file is part of a Liberty Eiffel library.
 2-- See the full copyright at the end.
 3--
 4deferred class ABSTRACT_BACKTRACKING_SEQUENCE
 5   --
 6   -- Abstract realisation of a sequence iterator
 7   -- for the ABSTRACT_BACKTRACKING
 8   --
 9   -- The ABSTRACT_BACKTRACKING uses the fields
10   -- continuation to record the continuation path
11   -- and calls the feature 'next_sequence' to let
12   -- the current object choose how to continue the
13   -- exploration.
14   --
15
16inherit
17   ABSTRACT_BACKTRACKING_POOLABLE
18      rename pool_link as previous,
19         set_pool_link as set_previous
20      export {ABSTRACT_BACKTRACKING_POOL, ABSTRACT_BACKTRACKING} set_previous
21      redefine previous
22      end
23
24feature {ABSTRACT_BACKTRACKING_POOL, ABSTRACT_BACKTRACKING}
25   previous: ABSTRACT_BACKTRACKING_SEQUENCE
26         -- For the linked stack of sequences.
27         -- Managed by ABSTRACT_BACKTRACKING.
28
29feature {ABSTRACT_BACKTRACKING}
30   continuation: ABSTRACT_BACKTRACKING_SEQUENCE
31         -- The sequence to continue after a success in
32         -- exploration of the current sequence.
33         -- Managed by ABSTRACT_BACKTRACKING.
34
35   set_continuation (value: like continuation)
36      do
37         continuation := value
38      ensure
39         definition: continuation = value
40      end
41
42   next_sequence (explorer: ABSTRACT_BACKTRACKING)
43         -- Called by ABSTRACT_BACKTRACKING to let
44         -- the current object switch to the next state
45         -- to explore.
46         -- Two actions must be performed by that feature:
47         --   - make iteration actions and then call
48         --      'pop_sequence' if this is the last state
49         --      to be explored.
50         --   - select the state to be evaluated or
51         --      call 'continue' or call 'backtrack'.
52      require
53         is_on_top: Current = explorer.top_sequence
54      deferred
55      end
56
57end -- class ABSTRACT_BACKTRACKING_SEQUENCE
58--
59-- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
60--
61-- Permission is hereby granted, free of charge, to any person obtaining a copy
62-- of this software and associated documentation files (the "Software"), to deal
63-- in the Software without restriction, including without limitation the rights
64-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
65-- copies of the Software, and to permit persons to whom the Software is
66-- furnished to do so, subject to the following conditions:
67--
68-- The above copyright notice and this permission notice shall be included in
69-- all copies or substantial portions of the Software.
70--
71-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
72-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
73-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
74-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
75-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
76-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
77-- THE SOFTWARE.