Книга: Embedded Linux development using Eclipse

8.1.2 UML Example

8.1.2 UML Example

Our example for working with UML is a classic embedded control application: an elevator. The problem is to implement the logic required to move the elevator between floors in response to user requests[12]. The elevator operates as follows:

• Each elevator has a set of m buttons, one for each floor. These illuminate when pressed and cause the elevator to move to the corresponding floor. The illumination is canceled when the elevator reaches the corresponding floor.

• Each floor, except the bottom and top floors, has two buttons: one to request an “up” elevator, and one to request a “down” elevator. These buttons illuminate when pressed. The illumination is canceled when the elevator visits the floor and is moving in the requested direction.

• When the elevator has no requests pending, it remains at its current floor with the doors closed.

To begin, we’ll need to create a Java project. The reason for starting out in Java is simply that UML tools seem much better integrated with Java. Change to the Java perspective and select File?New?Java Project. Name the project “elevator” and accept the defaults. Accept the defaults on the next screen and click Finish.

Expand the newly created elevator project and notice that there’s an src/ directory under it. Right-click the src/ directory and select New?Package. Name it “elevator” as well. The UML diagram files you will be creating can go anywhere. I suggest creating a new directory under the project to store them. With the elevator project selected in the Package Explorer view, select New?Folder and call it “models.” The project structure should now look like Figure 8.2.


Figure 8.2: Java project structure for UML. 

Оглавление книги


Генерация: 1.278. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз