CSSE 373 Formal Methods in Specification and Design

P3

Administrative Details

Purpose: practice modeling a system using JML

Please note: A big part of practical formal methods is having conversations with your client so that your model reflects what they really want. To give you practive with that, projects in this class are somewhat underspecified and require that you go somewhat beyond what is specifically covered in class. I look forward to helping you with that, which is why some class meetings are canceled for project work, but you need to ask for help.

Other details:

Problem Specification

Your task is to construct a JML model of the lift system from P2 that describes:

I'm providing a simulator for the hardware and for the humans who would push buttons in the lifts. I'm also providing a text-based view of the system that displays its state.

You will annotate two classes, control.LiftController and control.FloorController, with JML specifications, test them using JMLUnitNG, and run the simulator using these classes.

Tasks

  1. In Eclipse, check out the HigherExpectations project from your project team SVN repository.
  2. Study the provided code, noting the following:

  3. Your primary task is to add JML specifications to control.LiftController and control.FloorController, implement and test them using JMLUnitNG, and run the simulator using these classes.

    Annotate the class as follows:

    1. Add appropriate fields for tracking the state of the lift or floor.
    2. Add appropriate invariants to the class.
    3. Specify each public method, plus the constructor of the class. Each specification should include:
      • a pre-condition
      • an assignable clause
      • a post-condition

      To guide you, the ILiftController and IFloorController interfaces provide informal, javadoc descriptions of all the methods. Also, note that the interfaces include initially clauses that constrain your constructors.

      You may also find your (or my) Alloy model from P2 useful. I did.

    4. Implement the methods, introducing helper methods as needed.

    The simulator is designed to throw an exception and stop the simulation if your control algorithm makes an illegal request, such as asking a lift to move while its doors are open, open its doors while its moving, or do anything while out of service. Your controller will have to track the state of the system to avoid making such requests.

Rubric

I will evaluate your work using this grading rubric [pdf].

Turn In

Turn in your work by committing your Eclipse project to your team repository.