1. Describe the dynamic behavior of objects of class QUEUE. The operations avail

1. Describe the dynamic behavior of objects of class QUEUE. The operations available on such objects are ENQUEUE, to insert an item in the queue; DEQUEUF., to extract an item from a nonempty queue; is Empty, to query whether the queue ; and MERGE, to merge a queue with the current queue. 2. State charts introduce the useful notion of a history state. Normally, when a transition enters a composite sequential state, it enters that state's initial sub state (unless the transition targets a ¬†explicitly). However, in some cases, it can be useful to model the fact that the composite state “remembers” the sub state that was active prior to leaving the state, so that entering the composite state could resume from such a state. For example, in modeling the interrupts in a computer system, we would like to specify that the action being executed when the interrupt was received will be taken up after the response is taken care of. A history state is represented by a circle containing the symbol H. If we want a transition to activate the most recent , we show a transition from outside the composite state pointing directly to the history state. There is also a transition from the history state to a sequential substate, to indicate the substate that becomes active the first time we enter the composite state (i.e., before the composite state has a history). Describe a generalization of the lamp switch example of using composite states and his-tory states. The generalization consists of this: A general switch provides power to the building in which the lamp is located. The switch must be in the on position to allow the lamp to operate, and whenever the general switch is turned on, the lamp will be on or off, depending on the state in which it was the last time the general switch was turned off.

You may also like