Ejemplo n.º 1
0
 public void AddToTransitionModel(IMutableTransitionModel <S, E, C> model)
 {
     foreach (var action in m_Actions)
     {
         Add(model, action);
     }
 }
Ejemplo n.º 2
0
        private void Add(IMutableTransitionModel <S, E, C> model, IAction <S, E, C> action)
        {
            switch (m_Mode)
            {
            case Mode.Entry:
                model.AddEntryAction(m_State, action);
                break;

            case Mode.Exit:
                model.AddExitAction(m_State, action);
                break;

            default:
                throw new Exception("Invalid mode = " + m_Mode);
                break;
            }
        }
Ejemplo n.º 3
0
        public void AddToTransitionModel(IMutableTransitionModel <S, E, C> model)
        {
            if (m_Event == null)
            {
                string fromString = m_From == null ? "AnyState" : m_From.ToString();
                string toString   = m_To.ToString();
                string message    = "The transition (" + fromString + " -> " + toString + ") has to be performed on an event. " +
                                    "Use on() to specify on what event the transition should take place";
                throw new Exception(message);
            }

            if (m_From == null)
            {
                model.AddFromAllTransitions(m_To, m_Event, m_Condition, m_Actions);
            }
            else if (m_RunEntryAndExit)
            {
                model.AddTransition(m_From, m_To, m_Event, m_Condition, m_Actions);
            }
            else
            {
                model.AddInternalTransition(m_From, m_To, m_Event, m_Condition, m_Actions);
            }
        }