Presentation is loading. Please wait.

Presentation is loading. Please wait.

Activity diagrams Practice 7. Task 1  The first action in the activity is the adding the item to the order. If the order if formed (“ready”), then it.

Similar presentations


Presentation on theme: "Activity diagrams Practice 7. Task 1  The first action in the activity is the adding the item to the order. If the order if formed (“ready”), then it."— Presentation transcript:

1 Activity diagrams Practice 7

2 Task 1  The first action in the activity is the adding the item to the order. If the order if formed (“ready”), then it is sent to the receiver by the action “ShipOrder”, and the activity ends. Else another element of the order is added.  Using the fork and join nodes, add an action for sending the invoice (“SendInvoice”) so that it is executed after the order is formed, regardless of the sending of the order. Along with this, the activity does not end without sending the invoice.  Provide the option after adding the item to add another item to the order under the condition [continue] or to end the executing of the activity under the condition [cancel].  Let the action of adding an item takes t1 cycles, the action of sending of the order takes t2 cycles, the action of sending an invoice takes t3 cycles. The next action begins on the next cycle after the previous. Determine the total execution time of the activity, if there are k delivered elements in the order.

3 Task 2  The client “Customer” accesses the cashier by the action “AddressCashier”, the cashier greets the client and asks him for his papers by the action “AskDocuments”. The client gets a receipt for the payment of the money from the account and gives it to the cashier. The cashier checks the receipt by the action of giving money “GiveMoney” and returns to the client a few notes of a class “Note” in one pack. The client gets and recalculates money by the action “ReceiveMoney”, says goodbye (“Farewell”) and leaves completing the activity’s execution.  Add to the cashier the action to thank the customer (“ThankCustomer”) that occurs after the transfer of the notes, without waiting for the completion of the counting of banknotes by the client, but before he'll say goodbye.

4 Task 2  Add to the cashier the action for checking the passport (“CheckPassport”). The client passes the passport along with other documents, but the cashier first checks his passport, then uses the passport information when issuing money and returns the passport together with banknotes.  Changing the properties of the contacts, make sure that the cashier passes and the client counted banknotes one by one.  Calculate the total number of created and absorbed labels, transmitted by the edges of the activity, if the cashier gives the customer a single note.  List the classes, instances of which are used to perform the activity.

5 Task 3  The synchronous operations are defined in the class “Barrier”. The behavior of the class is described by the reentrant (isReentrant=true) activity, represented in fig.

6 Task 3  What values will be returned as a result of calling of operations one() and two()? Explain.  Using the fork and join nodes indicate that the return from the operation one() is only possible after calling the operation two(), and vice versa.

7 Task 4  Class “Semafore” implements a simple semaphore operations wait() and signal(). A single call to signal allows a single call to wait. Initially, the operation wait will wait for a call to signal. The class definition is presented in fig.

8 Task 4  Using the actions of receiving a call operation "AcceptCallAction" and "ReplyAction", imagine the behavior “basicSemafore” in the activity.  Modify the model so that the first call to wait wouldn’t expect the call to signal.  Modify the class “Semafore”. Implement a public operation signal(count:Integer), which permits to count (“count”) calls to wait.

9 Task 5  There is the activity diagram in fig.  What is returned as a result of the activity?  What is the type of the action "a+b"?  Now suppose that the behavior “add” is defined in the model, which implements the addition of two integers. What type of the action will this behavior have?  Modify the activity so that the activity will return the multiplication of the array elements.

10 Task 5

11 Task 6  The activity “Configure plugins" begins from the construction “BuildPluginsList” and displaying “DisplayPluginsList” the list of installed plugins. Then the operation continues only after receiving the signal from the user “UserActivityRecieved”. Depending on the user's choice there happens either the configuration of the specific plugin “ConfigureSelectedPlugin” or the installation of the new plugins “InstallNewPlugins”.

12 Task 6  Specify in the model that the operations “BuildPluginsList”, “ConfigureSelectedPlugins” and “InstallNewPlugins” are implemented in the controller of the multimedia player “PlayerController”. In the user interface “PlayerUI” the operation “DisplayPlugins” and the reception of signals “UserActivityRecieved” are implemented.  When the plugin list is built, you need to check in a background thread of execution the plugin updates on the server “UpdatePlugins”.

13 Task 6  Implement the update operation for plug-ins “UpdatePlugins”, which means the establishment of the connection with the server “EstablishConnection”, the check “CheckUpdates” and download updates UpdatePluginsfor each plugin, if there the updates exist. Using the area of the extension, add the appropriate elements to the model.

14 Task 7  From the initial action of the activity “BuildTrafficLights” the control flow enters the call behavior action “createInstance”. The result is placed in the output contact “result”. The control flow after the action “createInstance” goes to the call behavior action “createTrafficLights”. The action has an output contact of the type “TrafficLights”. After that the object stream enters the incoming contact of the call operation action of adding a traffic light “addTrafficLights”. This operation is called by the instance of the type “Controller”, which is passed through a second contact of the operation, going out of the object stream from “createInstance”.

15 Task 7  Modify the model, Specify that the traffic light is created with parameter 1 and is added by the action “addTrafficLights” with index 2.


Download ppt "Activity diagrams Practice 7. Task 1  The first action in the activity is the adding the item to the order. If the order if formed (“ready”), then it."

Similar presentations


Ads by Google