예제 #1
0
파일: FSM2PMTest.cs 프로젝트: wasowski/NMF
        public void TestFSM2PN1()
        {
            var fsm = new FSM.FiniteStateMachine()
            {
                ID = "Test"
            };

            var state1 = new FSM.State()
            {
                Name         = "Zustand 1",
                IsStartState = true
            };

            var state2 = new FSM.State()
            {
                Name       = "Zustand 2",
                IsEndState = true
            };

            var transition1 = new FSM.Transition()
            {
                StartState = state1,
                EndState   = state1,
                Input      = "a"
            };

            var transition2 = new FSM.Transition()
            {
                StartState = state1,
                EndState   = state2,
                Input      = "b"
            };

            var transition3 = new FSM.Transition()
            {
                StartState = state2,
                EndState   = state1,
                Input      = "a"
            };

            state1.Transitions.Add(transition1);
            state1.Transitions.Add(transition2);
            state2.Transitions.Add(transition3);

            fsm.States.Add(state1);
            fsm.States.Add(state2);
            fsm.Transitions.Add(transition1);
            fsm.Transitions.Add(transition2);
            fsm.Transitions.Add(transition3);

            var context = new TransformationContext(transformation);
            var pn      = TransformationEngine.Transform <FSM.FiniteStateMachine, PN.PetriNet>(fsm, context);

            Assert.AreEqual(fsm, context.Input[0]);
            Assert.AreEqual(pn, context.Output);

            AssertSimilar(fsm, pn, context.Trace);
        }
예제 #2
0
파일: FSM2PMTest.cs 프로젝트: FrederikP/NMF
        public void TestFSM2PN1()
        {
            var fsm = new FSM.FiniteStateMachine()
            {
                ID = "Test"
            };

            var state1 = new FSM.State()
            {
                Name = "Zustand 1",
                IsStartState = true
            };

            var state2 = new FSM.State()
            {
                Name = "Zustand 2",
                IsEndState = true
            };

            var transition1 = new FSM.Transition()
            {
                StartState = state1,
                EndState = state1,
                Input = "a"
            };

            var transition2 = new FSM.Transition()
            {
                StartState = state1,
                EndState = state2,
                Input = "b"
            };

            var transition3 = new FSM.Transition()
            {
                StartState = state2,
                EndState = state1,
                Input = "a"
            };

            state1.Transitions.Add(transition1);
            state1.Transitions.Add(transition2);
            state2.Transitions.Add(transition3);

            fsm.States.Add(state1);
            fsm.States.Add(state2);
            fsm.Transitions.Add(transition1);
            fsm.Transitions.Add(transition2);
            fsm.Transitions.Add(transition3);

            var context = new TransformationContext(transformation);
            var pn = TransformationEngine.Transform<FSM.FiniteStateMachine, PN.PetriNet>(fsm, context);

            Assert.AreEqual(fsm, context.Input[0]);
            Assert.AreEqual(pn, context.Output);

            AssertSimilar(fsm, pn, context.Trace);
        }
예제 #3
0
파일: Program.cs 프로젝트: FrederikP/NMF
        private static FSM.FiniteStateMachine CreateTestFiniteStateMachine()
        {
            var fsm = new FSM.FiniteStateMachine()
            {
                ID = "Test"
            };

            var state1 = new FSM.State()
            {
                Name = "Zustand 1",
                IsStartState = true
            };

            var state2 = new FSM.State()
            {
                Name = "Zustand 2",
                IsEndState = true
            };

            var transition1 = new FSM.Transition()
            {
                StartState = state1,
                EndState = state1,
                Input = "a"
            };

            var transition2 = new FSM.Transition()
            {
                StartState = state1,
                EndState = state2,
                Input = "b"
            };

            var transition3 = new FSM.Transition()
            {
                StartState = state2,
                EndState = state1,
                Input = "a"
            };

            state1.Transitions.Add(transition1);
            state1.Transitions.Add(transition2);
            state2.Transitions.Add(transition3);

            fsm.States.Add(state1);
            fsm.States.Add(state2);
            fsm.Transitions.Add(transition1);
            fsm.Transitions.Add(transition2);
            fsm.Transitions.Add(transition3);

            return fsm;
        }
예제 #4
0
        private static FSM.FiniteStateMachine CreateTestFiniteStateMachine()
        {
            var fsm = new FSM.FiniteStateMachine()
            {
                ID = "Test"
            };

            var state1 = new FSM.State()
            {
                Name         = "Zustand 1",
                IsStartState = true
            };

            var state2 = new FSM.State()
            {
                Name       = "Zustand 2",
                IsEndState = true
            };

            var transition1 = new FSM.Transition()
            {
                StartState = state1,
                EndState   = state1,
                Input      = "a"
            };

            var transition2 = new FSM.Transition()
            {
                StartState = state1,
                EndState   = state2,
                Input      = "b"
            };

            var transition3 = new FSM.Transition()
            {
                StartState = state2,
                EndState   = state1,
                Input      = "a"
            };

            state1.Transitions.Add(transition1);
            state1.Transitions.Add(transition2);
            state2.Transitions.Add(transition3);

            fsm.States.Add(state1);
            fsm.States.Add(state2);
            fsm.Transitions.Add(transition1);
            fsm.Transitions.Add(transition2);
            fsm.Transitions.Add(transition3);

            return(fsm);
        }