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