Presentation is loading. Please wait.

Presentation is loading. Please wait.

April 3, 200291.3913 R McFadyen1 Recall UML Class Diagram BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..*

Similar presentations


Presentation on theme: "April 3, 200291.3913 R McFadyen1 Recall UML Class Diagram BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..*"— Presentation transcript:

1 April 3, 200291.3913 R McFadyen1 Recall UML Class Diagram BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..* Assignment 3 Question 1

2 April 3, 200291.3913 R McFadyen2 BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..* Find all persons waiting at any bus stop on a bus route Collaborating classes: Assignment 3 Question 1

3 April 3, 200291.3913 R McFadyen3 BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..* Suppose the class model is modified to incorporate Villages: VillageList Village villages 0..* Assignment 3 Question 1

4 April 3, 200291.3913 R McFadyen4 class BusRoute { VillageList villages; void printWaitingPassengers () { villages->printWaitingPassengers (); } } class Village { BusStopList busstops; void printWaitingPassengers () { busstops->printWaitingPassengers (); } } class VillageList { Village villages[]; void printWaitingPassengers () { for (int i = 0; i < stops.length; i++) villages[i].printWaitingPassengers (); } Assignment 3 Question 1

5 April 3, 200291.3913 R McFadyen5 class BusStop { PersonList waiting; void printWaitingPassengers () { waiting.print (); } } class PersonList { Person people[]; void print () { for (int i = 0; i < people.length; i++) people[i].print (); } } class Person { String name; void print () { System.stdout.println (name); } } Assignment 3 Question 1

6 April 3, 200291.3913 R McFadyen6 :BusRoute :BusStopList :BusStop:PersonList:Person : VillageList: Village printWaitingPassengers () *printWaitingPassengers () printWaitingPassengers () *printWaitingPassengers () printWaitingPassengers () *print () printWaitingPassengers () Note: use of multiobjects, lifelines, names of messages/methods Assignment 3 Question 1

7 April 3, 200291.3913 R McFadyen7 Q 2. a AW1:AlarmWindowAC1:AlarmClock Alarmlisteners:Object 1:addAlarmListener(AW1) 1.1:add (AW1) B1:BeeperAC1:AlarmClock Alarmlisteners:Object 1:addAlarmListener(B1) 1.1:add (B1) Similar to Fig23.22 … subscribing

8 April 3, 200291.3913 R McFadyen8 Q 2. b AC1:AlarmClockAlarmlisteners:Object publishAlarmEvent onAlarmEvent setTime Note names of the messages and the names of the methods in the class model Similar to Fig23.23 … the alarm clock notifying its list of listeners

9 April 3, 200291.3913 R McFadyen9 Q 2. b AW1:AlarmWindow:field onAlarmEvent Note names of the messages and the names of the methods in the class model Similar to Fig23.24 … the alarm window displaying its alarm displayAlarm()

10 April 3, 200291.3913 R McFadyen10 Q 2. b B1:Beeper onAlarmEvent Note names of the messages and the names of the methods in the class model Similar to Fig23.24 … the beeper making its sound beep()

11 April 3, 200291.3913 R McFadyen11 Q 2. c AW1:AlarmWindowAC1:AlarmClock Alarmlisteners:Object 1:removeAlarmListener(AW1) 1.1:remove (AW1) B1:BeeperAC1:AlarmClock Alarmlisteners:Object 1: remove AlarmListener(B1) 1.1: remove (B1) Similar to Fig23.22 … unsubscribing Object is removed from the list of listeners – opposite of subscribing

12 April 3, 200291.3913 R McFadyen12 Q 3 :Store pc:ProductCatalog :ProductSpecification ps:ProductSpecification :Register create *:create *:add loadProdSpecs create Note that repetition is shown for two messages Note the activation box that is the origin for the repeated messages

13 April 3, 200291.3913 R McFadyen13 Q 4 Pmt:CreditPayment Cas:Object :ServicesFactory as:Object 1:requestApproval() authorize Note the associations and the direction indicators Note the numbering 2.3:postReceivable() 2.1:getAccountingService() 2.2:postSale() 2[reply.isApproved]:handleApproval()


Download ppt "April 3, 200291.3913 R McFadyen1 Recall UML Class Diagram BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..*"

Similar presentations


Ads by Google