1436 Elevator Model (on CD) Appendix H (lines (Cheapest web hosting)

1436 Elevator Model (on CD) Appendix H (lines 57 65). Line 64 of method doorOpened interrupts the Person s thread, which terminates method sleep of line 135. Method interrupt throws an InterruptedException received by a catch block (lines 147 155). Line 150 of this catch block unregisters the Person with the Door on the Floor, and line 154 calls private method enterAndRideElevator (lines 175 214) however, according to Fig. 5.29, if the Door on the Floor is already open when the Person arrives, the Person calls method enterAndRideElevator immediately. Line 178 of method enterAndRideElevator sends a personEntered event to personMoveListener, indicating that the Person is entering the Elevator. When the Person enters the Elevator, the Person s Location references the Elevator (lines 181 183). When the Person has entered the Elevator, lines 189 190 register the Person as a DoorListener with the Door in the Elevator. Lines 197 200 allow the Person to press the Button in the Elevator and to send a person- PressedButton event to the personMoveListener. Lines 206 207 invoke the synchronized method ride in the Elevator, ensuring that other Persons cannot occupy the Elevator. When the Elevator arrives, it sends an elevatorArrived event to the Door in the Elevator, which opens that Door and invokes method doorOpened of the Person. Method doorOpened, as previously mentioned, interrupts the Person s thread in this case, method interrupt terminates the sleep in method ride and allows the Person to exit the Elevator (allowing a Person waiting for the Elevator to enter). Method enterAndRideElevator returns, and lines 161 170 of method run make the Person exit the Elevatorand exit the simulation shortly thereafter. H.10 Component Diagrams Revisited In Section 13.17, we introduced the component diagram for the elevator simulation. In our simulation, the each class in the model imports package event we showed the components of package event in Fig. G.15. Figure H.14 presents the component diagram for package model. Each component in package model maps to a class from the class diagram of Fig. 15.21 package model aggregates package event. H.11 Conclusion This concludes discussion case study model. We hope you have enjoyed the design process of our elevator simulation using the UML, along with the presentation of object-oriented fundamentals and Java-specific topics, such as event handling and multithreading. Using the concepts discussed in this case study, you should now be able to tackle even larger systems. We encourage you to read Appendix I, which implements the ElevatorView, which transforms the ElevatorModelthat we have designed into a vibrant and interactive program abundant with graphics, animation and sound.
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Leave a Reply