/// <summary>
        /// Generates a transition with an extra check-delegate!
        /// </summary>
        /// <param name="states"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="inverted"></param>
        /// <param name="eventType"></param>
        /// <param name="checkDelegate"></param>
        /// <param name="finishedDelegate"></param>
        /// <returns></returns>
        public static FiniteStateMachineTransition <EventType> Generate(
            List <FiniteStateMachineState <EventType> > states, int start, int end, bool inverted, Type eventType,
            OsmSharp.Math.StateMachines.FiniteStateMachineTransitionCondition <EventType> .FiniteStateMachineTransitionConditionDelegate checkDelegate,
            TransitionFinishedDelegate finishedDelegate)
        {
            var conditions = new List <FiniteStateMachineTransitionCondition <EventType> >();

            conditions.Add(new FiniteStateMachineTransitionCondition <EventType>()
            {
                EventTypeObject = eventType,
                CheckDelegate   = checkDelegate
            });

            var trans = new FiniteStateMachineTransition <EventType>()
            {
                SourceState          = states[start],
                TargetState          = states[end],
                TransitionConditions = conditions,
                Finished             = finishedDelegate,
                Inverted             = inverted
            };

            states[start].Outgoing.Add(trans);
            return(trans);
        }
 /// <summary>
 /// Generates a non-inverted transition with an extra check-delegate!
 /// </summary>
 /// <param name="states"></param>
 /// <param name="start"></param>
 /// <param name="end"></param>
 /// <param name="eventType"></param>
 /// <param name="checkDelegate"></param>
 /// <param name="finishedDelegate"></param>
 /// <returns></returns>
 public static FiniteStateMachineTransition <EventType> Generate(
     List <FiniteStateMachineState <EventType> > states, int start, int end, Type eventType,
     OsmSharp.Math.StateMachines.FiniteStateMachineTransitionCondition <EventType> .FiniteStateMachineTransitionConditionDelegate checkDelegate,
     TransitionFinishedDelegate finishedDelegate)
 {
     return(FiniteStateMachineTransition <EventType> .Generate(states, start, end, false, eventType, checkDelegate, finishedDelegate));
 }
Ejemplo n.º 3
0
        public static FiniteStateMachineTransition <EventType> Generate(List <FiniteStateMachineState <EventType> > states, int start, int end, bool inverted, Type eventType, FiniteStateMachineTransitionCondition <EventType> .FiniteStateMachineTransitionConditionDelegate checkDelegate, FiniteStateMachineTransition <EventType> .TransitionFinishedDelegate finishedDelegate)
        {
            List <FiniteStateMachineTransitionCondition <EventType> > transitionConditionList = new List <FiniteStateMachineTransitionCondition <EventType> >();

            transitionConditionList.Add(new FiniteStateMachineTransitionCondition <EventType>()
            {
                EventTypeObject = eventType,
                CheckDelegate   = checkDelegate
            });
            FiniteStateMachineTransition <EventType> machineTransition1 = new FiniteStateMachineTransition <EventType>();

            machineTransition1.SourceState          = states[start];
            machineTransition1.TargetState          = states[end];
            machineTransition1.TransitionConditions = transitionConditionList;
            machineTransition1.Finished             = finishedDelegate;
            int num = inverted ? 1 : 0;

            machineTransition1.Inverted = num != 0;
            FiniteStateMachineTransition <EventType> machineTransition2 = machineTransition1;

            states[start].Outgoing.Add(machineTransition2);
            return(machineTransition2);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Generates a transition.
        /// </summary>
        /// <param name="states"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="inverted"></param>
        /// <param name="event_types"></param>
        /// <returns></returns>
        public static FiniteStateMachineTransition <EventType> Generate(List <FiniteStateMachineState <EventType> > states, int start, int end, bool inverted, params Type[] event_types)
        {
            List <FiniteStateMachineTransitionCondition <EventType> > conditions = new List <FiniteStateMachineTransitionCondition <EventType> >();

            foreach (Type type in event_types)
            {
                conditions.Add(new FiniteStateMachineTransitionCondition <EventType>()
                {
                    EventTypeObject = type
                });
            }

            FiniteStateMachineTransition <EventType> trans = new FiniteStateMachineTransition <EventType>()
            {
                SourceState          = states[start],
                TargetState          = states[end],
                TransitionConditions = conditions,
                Inverted             = inverted
            };

            states[start].Outgoing.Add(trans);
            return(trans);
        }
Ejemplo n.º 5
0
        public static FiniteStateMachineTransition <EventType> Generate(List <FiniteStateMachineState <EventType> > states, int start, int end, bool inverted, params Type[] eventTypes)
        {
            List <FiniteStateMachineTransitionCondition <EventType> > transitionConditionList = new List <FiniteStateMachineTransitionCondition <EventType> >();

            foreach (Type eventType in eventTypes)
            {
                transitionConditionList.Add(new FiniteStateMachineTransitionCondition <EventType>()
                {
                    EventTypeObject = eventType
                });
            }
            FiniteStateMachineTransition <EventType> machineTransition1 = new FiniteStateMachineTransition <EventType>();

            machineTransition1.SourceState          = states[start];
            machineTransition1.TargetState          = states[end];
            machineTransition1.TransitionConditions = transitionConditionList;
            int num = inverted ? 1 : 0;

            machineTransition1.Inverted = num != 0;
            FiniteStateMachineTransition <EventType> machineTransition2 = machineTransition1;

            states[start].Outgoing.Add(machineTransition2);
            return(machineTransition2);
        }
Ejemplo n.º 6
0
 public static FiniteStateMachineTransition <EventType> Generate(List <FiniteStateMachineState <EventType> > states, int start, int end, Type eventType, FiniteStateMachineTransitionCondition <EventType> .FiniteStateMachineTransitionConditionDelegate checkDelegate)
 {
     return(FiniteStateMachineTransition <EventType> .Generate(states, start, end, false, eventType, checkDelegate, (FiniteStateMachineTransition <EventType> .TransitionFinishedDelegate) null));
 }
Ejemplo n.º 7
0
 public static FiniteStateMachineTransition <EventType> Generate(List <FiniteStateMachineState <EventType> > states, int start, int end, params Type[] eventTypes)
 {
     return(FiniteStateMachineTransition <EventType> .Generate(states, start, end, false, eventTypes));
 }