23.08.2013 Views

Specification of Reactive Hardware/Software Systems - Electronic ...

Specification of Reactive Hardware/Software Systems - Electronic ...

Specification of Reactive Hardware/Software Systems - Electronic ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

392 Case Study<br />

The next process class we describe is the Product Info Keeper class (see Figures 12.6 and<br />

12.8). The first part <strong>of</strong> the specification is as follows:<br />

process class<br />

Product Info Keeper myId ¡<br />

instance variables<br />

myId<br />

productInfo<br />

: PIKeeperId<br />

: PI<br />

Recall that a Product Info Keeper contains zero or one PI instances. The aggregation relation<br />

was shown in the Object Class Diagram <strong>of</strong> Figure 12.9. This aggregation relation is<br />

implemented by the instance variable productInfo. If the keeper contains no PI instances,<br />

the variable is nil. Otherwise it refers to a data object <strong>of</strong> class PI.<br />

From Figures 12.6 and 12.8 it is straightforward to deduce the next part <strong>of</strong> the class<br />

description:<br />

communication channels<br />

pihp prks pisa pipo<br />

message interface<br />

pihp!free(PIKeeperId)<br />

pihp?store(PIKeeperId,PI)<br />

prks?serviceRequired(PIKeeperId,Service)<br />

prks!required<br />

prks!notRequired<br />

pisa?servicePerformed(PIKeeperId,Service)<br />

pipo?retrieve(PIKeeperId)<br />

pipo!take(PI)<br />

A Product Info Keeper can be in one <strong>of</strong> two behaviour states. The keeper is either free,<br />

or it is occupied by a product info. The two states will be modelled by the two methods<br />

noProductInfoStored respectively productInfoStored. Upon instantiation, a keeper always<br />

starts in state noProductInfoStored. Within this state it tries to send a free message to the<br />

Product Input Handler and waits for the arrival <strong>of</strong> a new product info (see Figure 12.6).<br />

The acceptance <strong>of</strong> the free message means that a Product Info Keeper is going to be used<br />

by the receiver <strong>of</strong> this message. The keeper makes a transition to state productInfoStored<br />

if the new PI is received. The specification is as follows:<br />

initial method call<br />

noProductInfoStored<br />

instance methods<br />

noProductInfoStored id:PIKeeperId<br />

pihp!free(myId);<br />

pihp?store(id,productInfo id=myId);<br />

productInfoStored

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!