simpleCommunicator

This machine manages communications using a "stop and wait" protocol. Only one message is allowed to be outstanding.

Number of events3
Events not handled0
Events handled in one state1
At least one event handled the same in all states?yes
Number of states2
Number of states with entry functions0
Number of states with exit functions0
States handling no events0
States handling exactly one event0
States with no way in0
States with no way out0
  SEND_MESSAGE NEVER_SEEN ACK
IDLE sendMessage
returns:
  • noEvent

transition : AWAITING_ACK

Since we're idle, we can simply send the message. Transitioning to the AWAITING_ACK state ensures that any other messages we're asked to send will be queued.

neverExecuted
transition : none

transition : none
AWAITING_ACK queueMessage
returns:
  • noEvent

transition : none

Since we're busy, we must queue the message for later sending. The queue will be checked when the ACK is received.

neverExecuted
transition : none
checkQueue
returns:
  • SEND_MESSAGE
  • noEvent

transition : IDLE

We've received our ACK for the previous message. It is time to check for any others.

Events
Total number of events:3
Events with no handlers:0
Events with one handler:1
Average event state density:83%
SEND_MESSAGE

Handled In 2 of 2 (100 %) States:

  • IDLE
  • AWAITING_ACK

Causes these actions to be taken:

  • sendMessage
  • queueMessage
NEVER_SEEN

Handled In 2 of 2 (100 %) States:

  • IDLE
  • AWAITING_ACK

Causes these actions to be taken:

  • neverExecuted
ACK

Handled In 1 of 2 (50 %) States:

  • AWAITING_ACK

Causes these actions to be taken:

  • checkQueue
States
Total number of states:2
States with no events:0
States with one event:0
States with no way in:0
States with no way out:0
Average state event density:83%
IDLE

Inbound Transitions:

  • AWAITING_ACK

Outbound Transitions:

  • AWAITING_ACK

Events Handled (2 of 3 for 66%):

  • NEVER_SEEN
  • SEND_MESSAGE

Actions Taken:

  • neverExecuted
  • sendMessage
AWAITING_ACK

Inbound Transitions:

  • IDLE

Outbound Transitions:

  • IDLE

Events Handled (3 of 3 for 100%):

  • NEVER_SEEN
  • SEND_MESSAGE
  • ACK

Actions Taken:

  • neverExecuted
  • queueMessage
  • checkQueue
Actions
neverExecuted

Matrices:

  • NEVER_SEEN, (IDLE, AWAITING_ACK)
sendMessage sendMessage sends a message from the queue. The message is expected to be there, since checkQueue will have been previously called.

Returns:
  • noEvent

Matrices:

  • SEND_MESSAGE, IDLE transitions to state AWAITING_ACK
queueMessage queueMessage adds a message to the queue

Returns:
  • noEvent

Matrices:

  • SEND_MESSAGE, AWAITING_ACK
checkQueue checkQueue only checks; it does not dequeue; that is done by sendMessage. Return SEND_MESSAGE when the queue is not empty.

Returns:
  • SEND_MESSAGE
  • noEvent

Matrices:

  • ACK, AWAITING_ACK transitions to state IDLE