/// <summary> /// Adds a transition to the <paramref name="model" />'s current state. /// </summary> /// <param name="model">The model the transition should be added for.</param> public void Add(RuntimeModel model) { ++ComputedTransitionCount; // 1. Serialize the model's computed state; that is the successor state of the transition's source state // modulo any changes resulting from notifications of fault activations var successorState = _targetStateMemory + _stateVectorSize * Count; var activatedFaults = FaultSet.FromActivatedFaults(model.Faults); model.Serialize(successorState); // 2. Make sure the transition we're about to add is activation-minimal if (!Add(successorState, activatedFaults)) { return; } // 3. Execute fault activation notifications and serialize the updated state if necessary if (model.NotifyFaultActivations()) { model.Serialize(successorState); } // 4. Store the transition _transitions[Count] = new Transition { TargetState = successorState, Formulas = new StateFormulaSet(_formulas), IsValid = true, }; ++Count; }