Sequential composition
Protocols can be combined using sequential composition. In a resulting protocol, the program of each agent is a concatenation of their respective programs from two protocols. For example, protocol Two_CR[I, R](c, r, c0, r0) is obtained by sequentially composing CR[I, R](c, r) with its reverse copy Reverse_CR[I,R](c0, ro) (which is in turn obtained by simple instantiation Reverse_CR[I,R](c0, ro)=CR[R,I](c0, r0)). The result is shown in the next figure.
Let’s step back to see one way to get to this result. Go to CR Template, open it, select the protocol CR, right-click and pick Copy Reference. Now go to Two_CR and Paste into the Editing pane. Notice that the icon is grayed and has a pointer, indicating that it is a reference instance. Select it, right-click and pick Create New Instance, creating CR_inst. Do the same to CR_inst, but edit its signature to Reverse_CR_inst, with the agent names reversed ([R,I]). At this stage you will see the following figure:
Now use the Protocol toolbar to create another protocol (wait to name it), and the toolbar again to create Instance Edges from the two CR instances above. Now name the composed protocol Two_CR[I,R](c,r,c0,r0)=CR_inst[I,R](c,r);Reverse_CR_inst[I,R](c0,r0). The curly brackets indicate sequential composition of the protocols separated by a semicolon.
Finally, select the composed protocol, right-click and select Generate Protocol Contents.