예제 #1
0
        public SystemStateGraph(MultipleModuleSystem system, bool includeTerminal)
        {
            _system = system;

            _allPossibleStates = GetAllPossibleStates();
            Transitions        = GetPossibleTransitions(includeTerminal);
        }
예제 #2
0
        public static SystemState FromModuleStatesIndices(
            MultipleModuleSystem system,
            int[] moduleStateIndices,
            IReadOnlyList <IReadOnlyList <ModuleState> > modulesStates,
            int stateIndex)
        {
            var moduleStates = new List <ModuleState>();

            for (var index = 0; index < moduleStateIndices.Length; index++)
            {
                var possibleModuleStates = modulesStates[index];
                var moduleStateIndex     = moduleStateIndices[index];
                moduleStates.Add(possibleModuleStates[moduleStateIndex]);
            }

            var systemState = new SystemState(moduleStates, stateIndex);

            systemState.IsTerminal        = system.IsStateTerminal(systemState);
            systemState.IsWaitingRecovery = system.WaitingRecovery(systemState);
            systemState.IsWorking         = system.IsWorking(systemState);

            return(systemState);
        }