public ContinuouslyRunningTest(String name, int myNumberOfRepeatedEvents)
            : base(name, new NSFEventThread(name))
        {
            numberOfRepeatedEvents = myNumberOfRepeatedEvents;

            // Events
            event1 = new NSFEvent("Event1", this);
            event2 = new NSFEvent("Event2", this);
            event3 = new NSFEvent("Event3", this);
            event4 = new NSFDataEvent<string>("Event4", this, "EventFourData");
            event5 = new NSFEvent("Event5", this);
            event6 = new NSFEvent("Event6", this);
            //States
            test2InitialState = new NSFInitialState("InitialTest3", this);
            state1 = new NSFCompositeState("State1", this, state1EntryAction, state1ExitAction);
            state2 = new NSFCompositeState("State2", this, null, null);
            //State 1 Region
            state1InitialState = new NSFInitialState("State1Initial", state1);
            state1History = new NSFDeepHistory("State1History", state1);
            state1_1 = new NSFCompositeState("State1_1", state1, null, null);
            state1_2 = new NSFCompositeState("State1_2", state1, null, null);
            // State1_2 Region
            state1_2InitialState = new NSFInitialState("State1_2Initial", state1_2);
            state1_2_1 = new NSFCompositeState("State1_2_1", state1_2, null, null);
            state1_2_2 = new NSFCompositeState("State1_2_2", state1_2, null, null);
            //Transitions
            // Test1 Region
            test1InitialToState1Transition = new NSFExternalTransition("Test1InitialToState1", test2InitialState, state1, null, null, null);
            state1ToState2Transition = new NSFExternalTransition("State1ToState2", state1, state2, event5, null, null);
            state2ToState1Transition = new NSFExternalTransition("State2ToState1", state2, state1, event6, null, null);
            // State1 Region
            state1InitialToState1HistoryTransition = new NSFExternalTransition("State1InitialToState1History", state1InitialState, state1History, null, null, null);
            state1HistoryToState1_1Transition = new NSFExternalTransition("State1HistoryToState1_1", state1History, state1_1, null, null, null);
            state1_1ToState1_2Transition = new NSFExternalTransition("State1_1ToState1_2", state1_1, state1_2, event1, null, null);
            state1_2ToState1_1Transition = new NSFExternalTransition("State1_2ToState1_1", state1_2, state1_1, event2, null, null);
            // State1_2 Region
            state1_2InitialStateToState1_2_1Transition = new NSFExternalTransition("State1_2InitialStateToState1_2_1", state1_2InitialState, state1_2_1, null, null, null);
            state1_2_1ToState1_2_2Transition = new NSFExternalTransition("State1_2_1ToState1_2_2", state1_2_1, state1_2_2, event3, null, null);
            state1_2_2ToState1_2_1Transition = new NSFExternalTransition("State1_2_2ToState1_2_1", state1_2_2, state1_2_1, event4, null, null);
        }
        private void createStateMachine()
        {
            // Event ructors take the form (name, parent)
            breakEvent = new NSFEvent("Break", this);
            breakOverEvent = new NSFEvent("BreakOver", this);
            milestoneMetEvent = new NSFEvent("MilestoneMet", this);
            backToWorkEvent = new NSFEvent("BackToWork", this);

            // Regions and states, from outer to inner
            // Initial state rutors take the form (name, parent)
            workHardPlayHardInitialState = new NSFInitialState("WorkHardPlayHardInitial", this);
            // Composite state rutors take the form (name, parent, entry actions, exit actions)
            takeABreakState = new NSFCompositeState("TakeABreak", this, null, null);
            breakOverState = new NSFCompositeState("BreakOver", this, null, null);
            breakOverInitialState = new NSFInitialState("BreakOverInitial", breakOverState);
            breakOverHistoryState = new NSFDeepHistory("BreakOverHistory", breakOverState);
            workHardState = new NSFCompositeState("WorkHard", breakOverState, null, null);
            playHardState = new NSFCompositeState("PlayHard", breakOverState, null, null);

            // Transitions, ordered internal, local, external
            // External transition rutors take the form (name, source, target, trigger, guard, action)
            workHardPlayHardInitialToBreakOverTransition = new NSFExternalTransition("WorkHardPlayHardInitialToBreakOver", workHardPlayHardInitialState, breakOverState, null, null, null);
            takeABreakToBreakOverTransition = new NSFExternalTransition("TakeABreakToBreakOver", takeABreakState, breakOverState, breakOverEvent, null, null);
            breakOverToTakeABreakTransition = new NSFExternalTransition("BreakOverToTakeABreak", breakOverState, takeABreakState, breakEvent, null, null);
            breakOverInitialToBreakOverHistoryTransition = new NSFExternalTransition("BreakOverInitialToBreakOverHistory", breakOverInitialState, breakOverHistoryState, null, null, null);
            breakOverHistoryToWorkHardTransition = new NSFExternalTransition("BreakOverHistoryToWorkHard", breakOverHistoryState, workHardState, null, null, null);
            workHardToPlayHardTransition = new NSFExternalTransition("WorkHardToPlayHard", workHardState, playHardState, milestoneMetEvent, null, null);
            playHardToWorkHardTransition = new NSFExternalTransition("PlayHardToWorkHard", playHardState, workHardState, backToWorkEvent, null, null);
        }
 public DeepHistoryTest(String name)
     : base(name, new NSFEventThread(name))
 {
     // Events
     event1 = new NSFEvent("Event1", this);
     event2 = new NSFEvent("Event2", this);
     event3 = new NSFEvent("Event3", this);
     event4 = new NSFEvent("Event4", this);
     event5 = new NSFEvent("Event5", this);
     event6 = new NSFEvent("Event6", this);
     //States
     test2InitialState = new NSFInitialState("InitialTest3", this);
     state1 = new NSFCompositeState("State1", this, null, null);
     state2 = new NSFCompositeState("State2", this, null, null);
     //State 1 Region
     state1InitialState = new NSFInitialState("State1Initial", state1);
     state1History = new NSFDeepHistory("State1History", state1);
     state1_1 = new NSFCompositeState("State1_1", state1, null, null);
     state1_2 = new NSFCompositeState("State1_2", state1, null, null);
     // State1_2 Region
     state1_2InitialState = new NSFInitialState("State1_2Initial", state1_2);
     state1_2_1 = new NSFCompositeState("State1_2_1", state1_2, null, null);
     state1_2_2 = new NSFCompositeState("State1_2_2", state1_2, null, null);
     //Transitions
     // Test1 Region
     test1InitialToState1Transition = new NSFExternalTransition("Test1InitialToState1", test2InitialState, state1, null, null, null);
     state1ToState2Transition = new NSFExternalTransition("State1ToState2", state1, state2, event5, null, null);
     state2ToState1Transition = new NSFExternalTransition("State2ToState1", state2, state1, event6, null, null);
     // State1 Region
     state1InitialToState1HistoryTransition = new NSFExternalTransition("State1InitialToState1History", state1InitialState, state1History, null, null, null);
     state1HistoryToState1_1Transition = new NSFExternalTransition("State1HistoryToState1_1", state1History, state1_1, null, null, null);
     state1_1ToState1_2Transition = new NSFExternalTransition("State1_1ToState1_2", state1_1, state1_2, event1, null, null);
     state1_2ToState1_1Transition = new NSFExternalTransition("State1_2ToState1_1", state1_2, state1_1, event2, null, null);
     // State1_2 Region
     state1_2InitialStateToState1_2_1Transition = new NSFExternalTransition("State1_2InitialStateToState1_2_1", state1_2InitialState, state1_2_1, null, null, null);
     state1_2_1ToState1_2_2Transition = new NSFExternalTransition("State1_2_1ToState1_2_2", state1_2_1, state1_2_2, event3, null, null);
     state1_2_2ToState1_2_1Transition = new NSFExternalTransition("State1_2_2ToState1_2_1", state1_2_2, state1_2_1, event4, null, null);
 }