Teams Practicals Solutions

Program Solutions

The solutions to the programming exercises can be found in the practicals/teams/solutions subdirectory. There is a separate directory for each of the exercises.

Answers to Questions

Exercise 3

Instruction 3: The spacecraft does not arrive. This is because the @parallel statement does not terminate now that the watch branch does not terminate.

Exercise 4

Instruction 4: ParallelFSM.ANY is used so that the @parallel statement succeeds if the flying branch terminates successfully.

Instruction 10: The statements after the @parallel statement are not executed. The watch branch is considered to fail – it is terminated when the fly reasoning method throws it an exception. When the @parallel statement has a mode of ParallelFSM.ALL and one of the branches fails the @parallel statement fails.

Note that the actual WatchMonitor plan is interrupted in this exercise. The plan passes because the TeamAbort exception is caught in the try/catch statement. Without the try/catch statement, the plan would be interrupted and terminate immediately – it would not even execute the fail reasoning method to indicate that it had terminated.