Define Actor Structure and Behavior

Define Actor Structure and Behavior

Save the model and visit the outline view. Within the outline view, right click on the MrPong actor and select Edit Structure. Select an Interface Port from the toolbox and add it to MrPong. Name the Port PingPongPort and select the PingPongProtocol

Do the same with MrPing but mark the port as conjugated

Define MrPongs behavior

Within the outline view, right click MrPong and select Edit Behavior. Create the following state machine:

The transition dialogues should look like this: For ping:

For pingSimple:

Define MrPing behavior

Within the outline view double click MrPing. Navigate the cursor to the behavior of MrPing. With the help of content assist create a new operation.

Name the operation printData and define the DemoData as a parameter.

Fill in the following code:

Operation printData(d: DemoData) : void {
            "System.out.printf(\"d.int32Val: %d\\n\",d.int32Val);"
            "System.out.printf(\"d.float64Val: %f\\n\",d.float64Val);"
            "System.out.printf(\"d.int8Array: \");"
            "for(int i = 0; i<d.int8Array.length; i++) {"
            "System.out.printf(\"%d \",d.int8Array[i]);}"
            "System.out.printf(\"\\nd.stringVal: %s\\n\",d.stringVal);"
}

For MrPing create the following state machine: (Remember that you can copy and paste the action code from the tutorial directory.)

The transition dialogues should look like this:

For init:

For wait1:

For next:

For wait2: