private ParentConnectionsInfo ConnectionsOf(object parentStateId)
        {
            for (int i = 0; i < _parentConnections.Count; i++)
            {
                var current = _parentConnections[i];

                if (HierarchicalStateMachineBuilderHelper.AreEquals(current.ParentStateId, parentStateId))
                {
                    return(current);
                }
            }

            return(null);
        }
        internal StateInfo StateInfoOf(object stateId)
        {
            for (int i = 0; i < _states.Count; i++)
            {
                var current = _states[i];

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

            return(null);
        }
コード例 #3
0
        public bool ContainsChild(object childStateId)
        {
            for (int i = 0; i < _serializedChildStateIds.Count; i++)
            {
                var current = _serializedChildStateIds[i];

                var deserializedId = GenericTypeSerializer.Deserialize(current, StateIdType);

                if (HierarchicalStateMachineBuilderHelper.AreEquals(deserializedId, childStateId))
                {
                    return(true);
                }
            }

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

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

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

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

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

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

                        if (HierarchicalStateMachineBuilderHelper.AreEquals(current.StateId, InitialStateId))
                        {
                            SetInitialDefaultStateIfThereIsAny();
                        }
                    }
                }
            }
        }
 private bool AreEquals(object stateId1, object stateId2)
 {
     return(HierarchicalStateMachineBuilderHelper.AreEquals(stateId1, stateId2));
 }