Exemplo n.º 1
0
        internal StateInfo StateInfoOf(object stateId)
        {
            for (int i = 0; i < _states.Count; i++)
            {
                var current = _states[i];

                if (PlainStateMachineBuilderHelper.AreEquals(stateId, current.StateId))
                {
                    return(current);
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        internal bool ContainsTransition(object StateFrom, object Trigger, object StateTo)
        {
            for (int i = 0; i < _transitions.Count; i++)
            {
                var current = _transitions[i];

                if (PlainStateMachineBuilderHelper.AreEquals(current.StateFrom, StateFrom) &&
                    PlainStateMachineBuilderHelper.AreEquals(current.Trigger, Trigger) &&
                    PlainStateMachineBuilderHelper.AreEquals(current.StateTo, StateTo))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 3
0
        internal bool ContainsState(object stateId)
        {
            if (stateId != null)
            {
                for (int i = 0; i < _states.Count; i++)
                {
                    var current = _states[i];

                    if (PlainStateMachineBuilderHelper.AreEquals(stateId, current.StateId))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 4
0
        internal void RemoveState(object stateId)
        {
            if (ContainsState(stateId))
            {
                for (int i = 0; i < _states.Count; i++)
                {
                    var current = _states[i];

                    if (PlainStateMachineBuilderHelper.AreEquals(stateId, current.StateId))
                    {
                        _states.RemoveAt(i);

                        if (PlainStateMachineBuilderHelper.AreEquals(current.StateId, InitialStateId))
                        {
                            SetInitialDefaultStateIfThereIsAny();
                        }
                    }
                }
            }
        }