Esempio n. 1
0
        public bool CreateTransitionCondition(ISignal signal, ITransition transition, params IState[] conditionalStates)
        {
            if (signal == null || !signals.ContainsKey((signal as ISignal <G>).Name) || transition == null || !transitions.ContainsKey((transition as ITransition <T>).Name))
            {
                return(false);
            }
            foreach (State <S, T, G> conditionalState in conditionalStates)
            {
                if (conditionalState == null || !states.ContainsKey(conditionalState.Name))
                {
                    return(false);
                }
            }

            SignalCondition <S, T, G> signalCondition = new SignalCondition <S, T, G>();

            signalCondition.AddCondition(conditionalStates);
            (signal as Signal <S, T, G>).AddTransitionCondition(signalCondition, transition as Transition <S, T, G>);
            return(true);
        }
Esempio n. 2
0
        public bool CreateEmitCondition(ISignal signal, params IState[] conditionalStates)
        {
            if (signal == null || !signals.ContainsKey((signal as Signal <S, T, G>).Name))
            {
                return(false);
            }
            foreach (State <S, T, G> conditionalState in conditionalStates)
            {
                if (conditionalState == null || !states.ContainsKey(conditionalState.Name))
                {
                    return(false);
                }
            }

            SignalCondition <S, T, G> signalCondition = new SignalCondition <S, T, G>();

            signalCondition.AddCondition(conditionalStates);
            (signal as Signal <S, T, G>).AddEmitCondition(signalCondition);
            return(true);
        }