Example #1
0
        /// <summary>
        ///   Classifies how the transition set must be updated.
        /// </summary>
        private void ClassifyActivatedFaults(FaultSet activatedFaults, int faultIndex, out bool addTransition, out bool addFaults,
                                             out bool cleanupTransitions)
        {
            addFaults          = false;
            cleanupTransitions = false;

            // Basic invariant of the fault list: it contains only sets of activation-minimal faults
            while (faultIndex != -1)
            {
                var faultSet = &_faults[faultIndex];
                faultIndex = faultSet->NextSet;

                // If the fault set is a subset of the activated faults, the current transition is not activation-minimal;
                // we can therefore safely ignore the transition; due to the list invariant, none of the remaining
                // fault sets in the list can be a superset of the activated faults because then the current fault set
                // would also be a subset of that other fault set, violating the invariant
                if (faultSet->ActivatedFaults.IsSubsetOf(activatedFaults))
                {
                    addTransition = faultSet->ActivatedFaults == activatedFaults;
                    return;
                }

                // If at least one of the previously added transitions that we assumed to be activation-minimal is
                // in fact not activation-minimal, we have to clean up the transition set
                if (activatedFaults.IsSubsetOf(faultSet->ActivatedFaults))
                {
                    cleanupTransitions = true;
                }
            }

            // If we get here, we must add the faults and the transition
            addTransition = true;
            addFaults     = true;
        }
Example #2
0
        /// <summary>
        ///   Removes all transitions that are no longer activation minimal due to the current transition.
        /// </summary>
        private void CleanupTransitions(FaultSet activatedFaults, int faultIndex, long stateHash)
        {
            var current     = faultIndex;
            var nextPointer = &_lookup[stateHash];

            while (current != -1)
            {
                var faultSet = &_faults[current];

                // Remove the fault set and the corresponding transition if it is a proper subset of the activated faults
                if (activatedFaults.IsSubsetOf(faultSet->ActivatedFaults) && activatedFaults != faultSet->ActivatedFaults)
                {
                    faultSet->Transition->IsValid = false;
                    *nextPointer = faultSet->NextSet;
                }

                if (nextPointer != &_lookup[stateHash])
                {
                    nextPointer = &faultSet->NextSet;
                }

                current = faultSet->NextSet;
            }
        }