We If given an a state of A, there

We have two state models, A and B.

Model B belongs to thePSM, so is an implementation of Model A, which belongs to the PIM. Model A willdescribe the application states and model B describe technically how to use theavailable services provided in order to achieve some functionality. An exampleof model A is the behaviour model developed for the financial systemapplication in Figure 4  State MachineBehavior.Assume, as in the case studies, that there are fewer statesin model A than in model B, and that every state in model B corresponds toexactly one state in model A.

Best services for writing your paper according to Trustpilot

Premium Partner
From $18.00 per page
4,8 / 5
4,80
Writers Experience
4,80
Delivery
4,90
Support
4,70
Price
Recommended Service
From $13.90 per page
4,6 / 5
4,70
Writers Experience
4,70
Delivery
4,60
Support
4,60
Price
From $20.00 per page
4,5 / 5
4,80
Writers Experience
4,50
Delivery
4,40
Support
4,10
Price
* All Partners were chosen among 50+ writing services by our Customer Satisfaction Team

This means that we can divide the states in modelB into groups, indexed by the state of model A they correspond to. If a is astate of A, then the states of B corresponding to a form an equivalence class.Let’s call that B(a).

Model transformations of behavior models represented as UMLstate machine in this research can be classified into five categories: 1.Single State to Single State Transformation If given an a state of A, there isone state in B(a), then call that state b, and the PIM/PSM mapping maps a intob.2.

Single State to More Than One State Transformation Ifgiven an a state of A, there are several states in B(a), then map a to thosestates if possible. The mapping is one state to many.3. Single State to part of a composite state Transformation4. Orphan State Transformation Assuming that every state ofA corresponds to at least one state of B. Otherwise, the orphan state of Acannot be implemented.

This could form part of an evaluation of the suitabilityof a PSM for implementing a given PIM.5. Forbidden  StateTransformation What happens if there are states in B that don’t correspond tosome state in A? Let’s call them forbidden states. Whether this is a problemwould depend on whether the transitions mapped from A ever take a state in B tothe forbidden state. Table 5. Issues and Behavioral Mapping Decisionssummarized Type ( state/transition) Mapping Single state to single state Directmapping Single state to multiple states Create a new  composite state with name=thePIM single state name, Create a new region with name=PIM statename+”Region” and  add to thenewly created composite state the PSM equivalence class states as sub statesOrphan State Ignored, in the case study, this type of states are handled implicitly by the PSM , so ignoring themis not going to create problems in the application logic. Forbidden State Thistype of states are important to complete the PSM logic, they are created in theresulting model. Single transition to single transition Direct mapping Singletransition to multiple transitions Map the transitions ( create the PSMtransitions) and check the target states of each transition for equivalencewith PIM.

Orphan transition Ignored Forbidden transition Createdin the resulting model the same process wasdone to the guards, actions, Initial node , Final node,  Fork node , Merge node with decision node ,are mapped to the equivalent.Models To Text and The Application ExecutionOverview The mapping of PIM behavior model- state Machine – tothe PSM behavior model yield a behavior model expressed as PSM constructs(state machine). The generated state machine models are highly reusable sincethey are expressed in UML. The models then can be transformed into other formsto enable complementing the class model and provide the big picture as acomplete application with class and behavior instances both available to beexecuted.Model transformations of behavior models represented as UMLstate machine in this research can be classified into five categories: SingleState to Single State, Single State to more than one  State, Single State to part of a compositestate, orphan state and forbidden state transformations.

 If the PSM has aforbidden state which can be entered for a given PIM, and the forbidden statehas actions that involved changes to any PIM class instances, then the PIM mustbe enhanced to take account that PSM behaviour, otherwise a PIM state can mapto a composite PSM state including the forbidden state. A test for this kind ofsituation would be valuable. Some observations are following:a. A forbidden state with no guard predicate will generallydo something necessary for the operation of the PSM which is not visible in thePIM, so the mapping is to a composite state.

b. A forbidden state with a guard predicate. A PIM may beconstrained in such a way that the PSM guard predicate will always evaluate totrue, in which case situation a above is obtained, or always false, in which case the forbidden state can neveroccur.c. In fact, if a forbidden state has no action with aneffect on the PIM database (PIM Classes model instances), then what it doeswould appear to be irrelevant to the PIM.d.

In the case where a forbidden state has a guard predicatewhich may evaluate to either true or false (this requires that the guardpredicate include terms which involve mapped PIM class model instances), andthe forbidden state has actions which change PIM class model instances, thenthe PSM behaviour is richer than the PIM, and the PIM needs to be enhanced tomake the necessary specifications.Another aspect in the state machine models is theconstraints in various forms. A constraint is formulated on the level ofclasses, but its semantics is applied on the level of objects. a. In the statemodels of both the PIM and PSM  thepredicates can take different forms. b.

PSM class may have more attributes thanPIM class, if such attributes existed in the constraint they need a decision.If the PSM attributes are left in the expression as specified by the PSM, thenwe have to note that  the values are PSMspecific and are not specified by the PIM instance model. c. PSM specificclasses that are not part of the PIM classes may also have their ownconstraints.

These classes may be part of an equivalence class too. d. Therelation between the attributes used in the guard expression involves themapping of PIM class model to the PSM class model first in order to map theattributes values of instances accordingly. e. The guard predicate in the PSM may be manually edited tofind the corresponding semantically equal behavior as specified by the PIM. DiscussionForbidden States Mapping The fifth  type of transformation identified is the”forbidden state” transformations where the PIM state model has no equivalentfor the PSM state.

Figure 7: Forbidden state C targeted by transition T1 Figure7 : Forbidden state C targeted by transition T1 shows state B which isequivalent to state A from the PIM state machine model. State B links to stateC  with the transition T1. The mapping decisions can be as follows:Non guarded Transitions from B to C:When T1 has no guard condition:• Safely ignore state C and do not include it in the PSM.In this case the PIM is followed strictly. The PSM containsmore functionality specified by the more states it has. In order for a PSM toimplement a PIM , its state should be superset of the PIM states.

The forbiddenstates can be used to enhance the PIM and alter its specification by mappingback from the PSM states to the PIM states. • Consider state C in theequivalence class of the PSM In this case the logic is to be completed byvisiting the forbidden state C from state B, since the transition T1 has nocondition. o The equivalence class would be A= { B, C }.  It can be mapped as a composite state, oranother new region containing both state B and C. o An example to thissituation is the printing of a receipt in the first case study. The PIM doesn’texpress explicitly that the successful completion of a transaction would resultin a print of a receipt describing the transaction. By mapping the constraints, the states and transitions ends up in the idle state of the PIM statemachine, while it continues to print and release the card in the PSM. In thissituation it is recommended to map the additional PSM states to the PIM one inorder to complete the application logic.

o Another example is the cleanUpforbidden state in the second case study. The PIM transitions to the end statewhen finished sending or receiving. The PSM cleans up the resources such asclosing the connection object before ending.

The cleanUp state is required inthe PSM so it is mapped and added to the equivalence class.Guarded Transitions from B to C:Figure 7 : Forbidden state C targeted by a guardedtransition T1In a state machine model, a guard condition is a booleancondition that is evaluated when the transition is initiated. The transition tothe target state occurs when the guard condition is evaluated to true.

In theUML notation, guard conditions are shown in square brackets.It is possible that in an implementation of a particular PIMthat the guard for a forbidden transition is always false. In this case, a forbidden state can safely be ignored as it can never bereached in that application. UML Constraints MappingInvariantAssuming the following invariant as follows:context Card inv: : expirationDate.isAfter(today) 1.Determine the context of the constraint in the PSM class model, let us call itPSMContext 2. Determine the PIM class that is equivalent to the PSM classdenoted by the , let us call it PIMContext.

3. Map theattributes of the PIMContext to the PSMContext 4. Check the OCL expression 5. For each attribute in theconstraint expression, map the equivalent attribute from the PIMContext class.6. Assess the OCL functions used ( involves checking the semantic of theconstraint) According to the class model mapping of the PIM to PSM, the ATMCardis mapped to a Card class in the PSM.

Since the Card is the context of the constraint,then we are going to map the equivalent class attribute value for each objectof type ATMCard from  the instances modelinto the PSM instance model. Note that the name of both attributes need not bethe same.Figure 7 PIM  ATMCardClassFigure 7 PSM Card ClassObservations: 1. PSM class may have more attributes than PIMclass, if such attributes existed in the constraint they need a decision. Ifthe PSM attributes are left in the expression as specified by the PSM, then wehave to note that  the values are PSMspecific and are not specified by the PIM instance model. 2.

PSM specificclasses that are not part of the PIM classes may also have their ownconstraints. These classes may be part of an equivalence class too. Pre and Postconditioncontext ATM::dispence(amount : Integer)pre: self.inState=performingTransactionor pre: oclInState(performingTransaction);The pre condition specifies that the state machine that isowned by the context object- ATM object – is in a specific state in order toenable the execution of the operation dispense. In this case the mapping shouldcheck that the state specified is equivalent to some state in the PIM and ifthere is no constraint , a decision has to be made.

Because the PSM constraintsare stronger than PIM ones, the decision here can be to keep the constraint asit is in the PSM.State Machine ConstraintA Constraint may be applied to a State machine in the sameway as for a Class to specify an invariant of the State machine. The guardcondition of a State machine transition may be specified by associating aconstraint with a transitionFigure 7 Part of the PSM ATM states model In Figure 7  Part of the PSM ATM states modelFigure 7  Part of the PSM ATM states model  above the transition from Idle state toVerifying state is constrained with a guard condition that checks the booleanproperty “cardInserted” in the PSM Card class.

The navigation fromthe ATM context – who owns the states – to the class Card is donethrough the userCard association end that associated with the ATMUserSessionclass. The “fundingNeeded” is a property of the class BankCustomer inthe PIM. BankCustomer is mapped to ATMUserSession in the class model mapping .Each ATMUserSession  is associated with auser card of Card class. So the relation between the attributes used in theconstraint expression involves the mapping of PIM class model to the PSM classmodel first in order to map the attributes values of instances accordingly.Example 2 In the state models of both the PIM and PSM  the predicates can take different forms. Forexample the PIMClient class  in themessaging case study has an attribute newsCount that specify the number ofmessages generated and sent , with a default value set to 3, while the PSM Client class has a guard predicate again?which is true if we want to stop message generation and sending.

The guardpredicate in the PSM may be edited to find the corresponding semantically equalbehavior as specified by the PIM. Figure 7 PIMClient and the sending stateFigure 7 Client class and send state A mapping solution canbe as follows: The specification  body ofthe PSM constrain  has to include thecheck expressed by the PIM constraint. count=0 Beside that a new attribute or a complete data structure tohold the attributes and values from the PIM should be invented and attached tothe PSM in order to preserve the semantic specified in the PIM.A semi manualapproach is needed.