private void createStateMachine()
        {
            // State Machine Components
            // Define and initialize in the order:
            //   1) Events
            //   2) Regions and states, from outer to inner
            //   3) Transitions, ordered internal, local, external
            //   4) Group states and transitions within a region together.

            // Events
            // Event constructors take the form (name, parent)
            // Data event constructors take the form (name, parent, data payload)
            newCommandEvent      = new NSFDataEvent <String>("NewCommand", this, "CommandPayload");
            newResponseEvent     = new NSFDataEvent <String>("NewResponse", this, "ResponsePayload");
            responseTimeoutEvent = new NSFEvent("ResponseTimeout", this);
            resetEvent           = new NSFEvent("Reset", this);

            // Regions and states, from outer to inner
            // Initial state construtors take the form (name, parent)
            initialCommandProcessorState = new NSFInitialState("InitialCommandProcessor", this);
            // Composite state construtors take the form (name, parent, entry action, exit action)
            waitForCommandState  = new NSFCompositeState("WaitForCommand", this, null, null);
            waitForResponseState = new NSFCompositeState("WaitForResponse", this, waitForResponseEntryActions, waitForResponseExitActions);
            errorState           = new NSFCompositeState("Error", this, errorEntryActions, null);
            resetState           = new ResetStrategy("Reset", this);

            // Transitions, ordered internal, local, external
            // Internal transition construtors take the form (name, state, trigger, guard, action)
            reactionToNewCommand = new NSFInternalTransition("ReactionToNewCommand", this, newCommandEvent, null, queueCommand);
            // External transition construtors take the form (name, source, target, trigger, guard, action)
            initialCommandProcessorToWaitForCommandTransition = new NSFExternalTransition("InitialToWaitForCommand", initialCommandProcessorState, waitForCommandState, null, null, null);
            waitForCommandToWaitForResponseTransition         = new NSFExternalTransition("WaitForCommandToWaitForResponse", waitForCommandState, waitForResponseState, null, hasCommand, sendCommand);
            waitForResponseToWaitForCommandTransition         = new NSFExternalTransition("WaitForResponseToWaitForCommand", waitForResponseState, waitForCommandState, newResponseEvent, isResponse, handleResponse);
            waitForResponseToErrorTransition = new NSFExternalTransition("WaitForResponseToError", waitForResponseState, errorState, responseTimeoutEvent, null, null);
            errorToResetTransition           = new NSFExternalTransition("ErrorToReset", errorState, resetState, resetEvent, null, null);
            resetToWaitForCommandTransition  = new NSFExternalTransition("ResetToWaitForCommand", resetState, waitForCommandState, null, isReady, null);
        }
        private void createStateMachine()
        {
            // State Machine Components
            // Define and initialize in the order:
            //   1) Events
            //   2) Regions and states, from outer to inner
            //   3) Transitions, ordered internal, local, external
            //   4) Group states and transitions within a region together.

            // Events
            // Event constructors take the form (name, parent)
            // Data event constructors take the form (name, parent, data payload)
            newCommandEvent = new NSFDataEvent<String>("NewCommand", this, "CommandPayload");
            newResponseEvent = new NSFDataEvent<String>("NewResponse", this, "ResponsePayload");
            responseTimeoutEvent = new NSFEvent("ResponseTimeout", this);
            resetEvent = new NSFEvent("Reset", this);

            // Regions and states, from outer to inner
            // Initial state construtors take the form (name, parent)
            initialCommandProcessorState = new NSFInitialState("InitialCommandProcessor", this);
            // Composite state construtors take the form (name, parent, entry action, exit action)
            waitForCommandState = new NSFCompositeState("WaitForCommand", this, null, null);
            waitForResponseState = new NSFCompositeState("WaitForResponse", this, waitForResponseEntryActions, waitForResponseExitActions);
            errorState = new NSFCompositeState("Error", this, errorEntryActions, null);
            resetState = new ResetStrategy("Reset", this);

            // Transitions, ordered internal, local, external
            // Internal transition construtors take the form (name, state, trigger, guard, action)
            reactionToNewCommand = new NSFInternalTransition("ReactionToNewCommand", this, newCommandEvent, null, queueCommand);
            // External transition construtors take the form (name, source, target, trigger, guard, action)
            initialCommandProcessorToWaitForCommandTransition = new NSFExternalTransition("InitialToWaitForCommand", initialCommandProcessorState, waitForCommandState, null, null, null);
            waitForCommandToWaitForResponseTransition = new NSFExternalTransition("WaitForCommandToWaitForResponse", waitForCommandState, waitForResponseState, null, hasCommand, sendCommand);
            waitForResponseToWaitForCommandTransition = new NSFExternalTransition("WaitForResponseToWaitForCommand", waitForResponseState, waitForCommandState, newResponseEvent, isResponse, handleResponse);
            waitForResponseToErrorTransition = new NSFExternalTransition("WaitForResponseToError", waitForResponseState, errorState, responseTimeoutEvent, null, null);
            errorToResetTransition = new NSFExternalTransition("ErrorToReset", errorState, resetState, resetEvent, null, null);
            resetToWaitForCommandTransition = new NSFExternalTransition("ResetToWaitForCommand", resetState, waitForCommandState, null, isReady, null);
        }