Task: Introduction: This project combines code generation from a state machine (UMPLE as presented in lecture 15 and tutorial 5) with AspectJ (presented in lectures 16-18, tutorial 6, and labs 6-7). You can download the file elevator.zip if this assignment and import it as a project into Eclipse or STS as shown in quick explanation of the code You will work on an elevator control program. The code for the following state machine of the elevator is already generated into class Elevator:
A GUI of the elevator is implemented in class ElevatorVis. An example of how to instantiate the elevator visualization and how to execute the state machine is provided in class ElevatorRunner. You can modify the execution steps here. It is your task to develop aspects using AspectJ to improve the behavior of the generated code. You are not allowed to modify any code other than the contents of ElevatorRunner.java and Task1.aj to Task4.aj. Task 1: Tracing
Whenever an event occurs but is not processed by the state machine, print the name of the event and print that it hasn’t been processed. Assume that all public methods of class Elevator that return a Boolean value are processing events. The return value is false if the event has not been processed. As an example, the execution of class ElevatorRunner should show a trace starting like this: From null to Idle From Idle to DoorClosingMovingUp From DoorClosingMovingUp to Moving Event upRequest not processed. Implement pointcuts and advice for both a) and b) in aspect Task1.aj. Ensure that this aspect will still work when the model changes, e.g., when adding or removing states or when adding or removing events the new functionality should apply. Task 2: New transition from all states Implement advice Task2.aj to add a transition from any state to state Idle when the event noRequest occurs. Hint: The event noRequest occurs whenever the public method Elevator.noRequest() is executed Task 3: Transition from all states Implement advice Task3.aj to keep track of the current floor that an elevator is on. Make sure your advice will work when there are multiple elevators, i.e., do not store the current floor inside the advice.
Task 4: Improve visualization Implement aspect Task4.aj to show an image a blocked elevator door (by calling method ElevatorVis.gui.show(“open_blocked”)) whenever the state machine is in state AtFloor, the event doorClosingRequest occurs, and the elevator is blocked.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.