/src/lib/automaton/automaton_context.e
Specman e | 62 lines | 31 code | 8 blank | 23 comment | 0 complexity | f9aa56b53d16ddcfaaba496d5e6f1acb MD5 | raw file
1-- This file is part of a Liberty Eiffel library. 2-- See the full copyright at the end. 3-- 4class AUTOMATON_CONTEXT[E_] 5 6create {AUTOMATON} 7 make 8 9feature {ANY} -- user data 10 data: E_ 11 12 is_valid: BOOLEAN 13 14 current_state: STATE[E_] 15 16feature {AUTOMATON} -- state memo 17 set_current_state (s: like current_state) 18 require 19 s /= Void 20 do 21 current_state := s 22 ensure 23 current_state = s 24 end 25 26 invalidate 27 do 28 is_valid := False 29 ensure 30 not is_valid 31 end 32 33feature {} 34 make (e: E_) 35 do 36 data := e 37 is_valid := True 38 ensure 39 data = e 40 end 41 42end -- class AUTOMATON_CONTEXT 43-- 44-- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file. 45-- 46-- Permission is hereby granted, free of charge, to any person obtaining a copy 47-- of this software and associated documentation files (the "Software"), to deal 48-- in the Software without restriction, including without limitation the rights 49-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 50-- copies of the Software, and to permit persons to whom the Software is 51-- furnished to do so, subject to the following conditions: 52-- 53-- The above copyright notice and this permission notice shall be included in 54-- all copies or substantial portions of the Software. 55-- 56-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 57-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 58-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 59-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 60-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 61-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 62-- THE SOFTWARE.