def _interfere_acceptance(cls, snapshot_set_db, EntryRecipeDb, StateIndex): """If the acceptance scheme differs for only two recipes, then the acceptance must be determined upon entry and stored in the LastAcceptance register. RETURN: [0] Accumulated 'accepter' """ # Interference requires determined entry recipes. assert none_is_None(EntryRecipeDb.itervalues()) # Irrelevant E_R.AcceptanceRegister? Impossible! Acceptance is relevant # for all states! '.accepter is None' is not treated. accepter = UniformObject.from_iterable( recipe.accepter for recipe in EntryRecipeDb.itervalues()).plain_content() if accepter != E_Values.VOID: # Homogeneity pass else: # Inhomogeneity accepter = [ cls.RestoreAcceptance ] snapshot_set_db[E_R.AcceptanceRegister] = set([StateIndex]) assert accepter and accepter[-1].pre_context_id() == E_PreContextIDs.NONE return accepter
def from_scheme(SchemeAsList): result = TargetByStateKey() result.__scheme = tuple(SchemeAsList) result.__scheme_id = None result.__uniform_door_id = UniformObject.from_iterable(SchemeAsList).content assert isinstance(result.__uniform_door_id, (types.NoneType, DoorID)) return result
def from_scheme(SchemeAsList): result = TargetByStateKey() result.__scheme = tuple(SchemeAsList) result.__scheme_id = None result.__uniform_door_id = UniformObject.from_iterable( SchemeAsList).content assert isinstance(result.__uniform_door_id, (types.NoneType, DoorID)) return result
def __init__(self, Candidate): StateA = Candidate.state_a StateB = Candidate.state_b # Combined DropOut and Entry schemes are generated by the same function transition_map, target_scheme_n = combine_maps(StateA.transition_map, StateB.transition_map) ski_db = StateKeyIndexDB(StateA.state_index_sequence() + StateB.state_index_sequence()) MegaState.__init__(self, index.get(), transition_map, ski_db) self.uniform_entry_OpList = UniformObject.from_iterable(( StateA.uniform_entry_OpList, StateB.uniform_entry_OpList)) self.__target_scheme_n = target_scheme_n self.__engine_type = None # StateA.engine_type MegaState.bad_company_set(self, StateA.bad_company().union(StateB.bad_company()))
def __init__(self, Candidate): StateA = Candidate.state_a StateB = Candidate.state_b # Combined DropOut and Entry schemes are generated by the same function transition_map, target_scheme_n = combine_maps(StateA.transition_map, StateB.transition_map) ski_db = StateKeyIndexDB(StateA.state_index_sequence() + StateB.state_index_sequence()) MegaState.__init__(self, index.get(), transition_map, ski_db, dial_db=StateA.entry.dial_db) self.uniform_entry_OpList = UniformObject.from_iterable(( StateA.uniform_entry_OpList, StateB.uniform_entry_OpList)) self.__target_scheme_n = target_scheme_n self.__engine_type = None # StateA.engine_type MegaState.bad_company_set(self, StateA.bad_company().union(StateB.bad_company()))
def _interfere_input_position_storage(cls, snapshot_set_db, EntryRecipeDb, RequiredVariableSet, StateIndex): """Each position register is considered separately. If for one register the offset differs, then it can only be determined from storing it in this mouth state and restoring it later. """ assert none_is_None( flatten_it_list_of_lists(recipe.ip_offset_db.itervalues() for recipe in EntryRecipeDb.itervalues())) ip_offset_db = {} for variable_id in RequiredVariableSet: if type(variable_id) != tuple: continue register_id = variable_id[1] # Irrelevant position register? Possible! A recipe that considers # a position register irrelevant is 'equal' to any other. Thus, it # can be filtered out. Irrelevant position register is not mentioned # in 'ip_offset_db' => 'offset = None'. offset_list = [ recipe.ip_offset_db.get(register_id) for recipe in EntryRecipeDb.itervalues() ] offset = UniformObject.from_iterable( x for x in offset_list if x is not None).plain_content() if offset != E_Values.VOID: # Homogeneity pass else: # Inhomogeneity offset = E_Values.RESTORE snapshot_set_db[variable_id] = set([StateIndex]) ip_offset_db[register_id] = offset assert none_is_None(ip_offset_db.itervalues()) return ip_offset_db
def _interfere_read_position_storage(cls, snapshot_set_db, EntryRecipeDb, RequiredVariableSet, StateIndex): """Each position register is considered separately. If for one register the offset differs, then it can only be determined from storing it in this mouth state and restoring it later. """ assert none_is_None( flatten_it_list_of_lists(recipe.ip_offset_db.itervalues() for recipe in EntryRecipeDb.itervalues())) ip_offset_db = {} for variable_id in RequiredVariableSet: if type(variable_id) != tuple: continue register_id = variable_id[1] # Irrelevant position register? Possible! A recipe that considers # a position register irrelevant is 'equal' to any other. Thus, it # can be filtered out. Irrelevant position register is not mentioned # in 'ip_offset_db' => 'offset = None'. offset_list = [ recipe.ip_offset_db.get(register_id) for recipe in EntryRecipeDb.itervalues() ] offset = UniformObject.from_iterable( x for x in offset_list if x is not None).plain_content() if offset != E_Values.VOID: # Homogeneity pass else: # Inhomogeneity offset = E_Values.RESTORE snapshot_set_db[variable_id] = set([StateIndex]) ip_offset_db[register_id] = offset assert none_is_None(ip_offset_db.itervalues()) return ip_offset_db