Пример #1
0
        /// <summary>
        /// Initializes this machine.
        /// </summary>
        /// <returns></returns>
        private static FiniteStateMachineState <MicroPlannerMessage> Initialize()
        {
            // generate states.
            List <FiniteStateMachineState <MicroPlannerMessage> > states = FiniteStateMachineState <MicroPlannerMessage> .Generate(5);

            // state 3 is final.
            states[4].Final = true;

            // 0
            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 0, 1, typeof(MicroPlannerMessageArc));

            // 1
            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 1, 0, typeof(MicroPlannerMessagePoint),
                                                                         new FiniteStateMachineTransitionCondition <MicroPlannerMessage> .FiniteStateMachineTransitionConditionDelegate(TestNonSignificantTurn));

            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 1, 2, typeof(MicroPlannerMessagePoint),
                                                                         new FiniteStateMachineTransitionCondition <MicroPlannerMessage> .FiniteStateMachineTransitionConditionDelegate(TestSignificantTurn));

            // 2
            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 2, 3, typeof(MicroPlannerMessageArc),
                                                                         new FiniteStateMachineTransitionCondition <MicroPlannerMessage> .FiniteStateMachineTransitionConditionDelegate(TestVeryShortArc));

            // 3
            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 3, 4, typeof(MicroPlannerMessagePoint),
                                                                         new FiniteStateMachineTransitionCondition <MicroPlannerMessage> .FiniteStateMachineTransitionConditionDelegate(TestSignificantTurn));

            // return the start automata with intial state.
            return(states[0]);
        }
Пример #2
0
        /// <summary>
        /// Initializes this machine.
        /// </summary>
        /// <returns></returns>
        private static FiniteStateMachineState <MicroPlannerMessage> Initialize()
        {
            // generate states.
            List <FiniteStateMachineState <MicroPlannerMessage> > states = FiniteStateMachineState <MicroPlannerMessage> .Generate(3);

            // state 2 is final.
            states[2].Final = true;

            // 0
            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 0, 0, typeof(MicroPlannerMessageArc));

            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 0, 1, typeof(MicroPlannerMessagePoint),
                                                                         new FiniteStateMachineTransitionCondition <MicroPlannerMessage> .FiniteStateMachineTransitionConditionDelegate(TestRoundaboutEntry));

            // 1
            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 1, 1, typeof(MicroPlannerMessagePoint),
                                                                         new FiniteStateMachineTransitionCondition <MicroPlannerMessage> .FiniteStateMachineTransitionConditionDelegate(TestNonRoundaboutExit));

            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 1, 1, typeof(MicroPlannerMessageArc),
                                                                         new FiniteStateMachineTransitionCondition <MicroPlannerMessage> .FiniteStateMachineTransitionConditionDelegate(TestRoundaboutArc));

            // 2
            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 1, 2, typeof(MicroPlannerMessagePoint),
                                                                         new FiniteStateMachineTransitionCondition <MicroPlannerMessage> .FiniteStateMachineTransitionConditionDelegate(TestRoundaboutExit));

            // return the start automata with intial state.
            return(states[0]);
        }
Пример #3
0
        /// <summary>
        /// Initializes this machine.
        /// </summary>
        /// <returns></returns>
        private static FiniteStateMachineState <MicroPlannerMessage> Initialize()
        {
            // generate states.
            List <FiniteStateMachineState <MicroPlannerMessage> > states = FiniteStateMachineState <MicroPlannerMessage> .Generate(2);

            // state 2 is final.
            states[1].Final = true;

            // 0
            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 0, 0, typeof(MicroPlannerMessageArc));

            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 0, 0, typeof(MicroPlannerMessagePoint),
                                                                         new FiniteStateMachineTransitionCondition <MicroPlannerMessage> .FiniteStateMachineTransitionConditionDelegate(TestNonSignificantTurnNonPoi));

            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 0, 1, typeof(MicroPlannerMessagePoint),
                                                                         new FiniteStateMachineTransitionCondition <MicroPlannerMessage> .FiniteStateMachineTransitionConditionDelegate(TestPoi));

            // return the start automata with intial state.
            return(states[0]);
        }
Пример #4
0
        /// <summary>
        /// Builds the initial states.
        /// </summary>
        /// <returns></returns>
        protected override FiniteStateMachineState <MicroPlannerMessage> BuildStates()
        {
            // generate states.
            List <FiniteStateMachineState <MicroPlannerMessage> > states = FiniteStateMachineState <MicroPlannerMessage> .Generate(3);

            // state 3 is final.
            states[2].Final = true;

            // 0
            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 0, 1, typeof(MicroPlannerMessageArc));

            // 1
            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 1, 1, typeof(MicroPlannerMessageArc));

            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 1, 1, typeof(MicroPlannerMessagePoint),
                                                                         new FiniteStateMachineTransitionCondition <MicroPlannerMessage> .FiniteStateMachineTransitionConditionDelegate(TestNonSignificantTurnNonPoi));

            FiniteStateMachineTransition <MicroPlannerMessage> .Generate(states, 1, 2, typeof(MicroPlannerMessagePoint),
                                                                         new FiniteStateMachineTransitionCondition <MicroPlannerMessage> .FiniteStateMachineTransitionConditionDelegate(TestPoi));

            // return the start automata with intial state.
            return(states[0]);
        }