예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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();
                        }
                    }
                }
            }
        }