11.12.2012 Views

Model-Driven Evolution of Software Architectures - Software and ...

Model-Driven Evolution of Software Architectures - Software and ...

Model-Driven Evolution of Software Architectures - Software and ...

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.

158 Chapter7. <strong>Model</strong>-<strong>Driven</strong>Migration<br />

helper context UML!StateVertex def: getPredecessors:Set(UML!<br />

<strong>Model</strong>Element) =<br />

if self.incoming->isEmpty() then<br />

Set{}<br />

else if self.isOrTaskStateJoin then<br />

self.getFork.outgoing->collect(e|e.guard)->select(e|e.<br />

isOrTaskGuard)<br />

else if self.incoming->collect(e|e.guard)->select(e|not e.<br />

oclIsUndefined())->exists(e|e.isOrTaskGuard or if e.oppositeGuard.<br />

oclIsUndefined() then false else e.oppositeGuard.isOrTaskGuard<br />

endif) then<br />

Set{}<br />

else if self.incoming->collect(e|e.source)->select(e|e.isTaskState)<br />

->isEmpty() then<br />

self.incoming->collect(e|e.source.getPredecessors)->flatten()<br />

else<br />

self.incoming->collect(e|e.source)->select(e|e.isTaskState)<br />

endif endif endif endif;<br />

Listing 7.6:CollectpredecessorsonStateVertex<br />

thefiniteset<strong>of</strong>alldirectprecedingmodellingelementsthatmaymaptoa<br />

task.<br />

Concurrentexecution Thenormalisedpatternforconcurrency,asdiscussed<br />

inSection7.6,isaCompositeStatewithorthogonalregions.Toaddressthe<br />

concurrentexecutionconcernweneedtoidentifyinstances<strong>of</strong>suchpatterns<br />

inthesourcemodel.<br />

WedefinedatransformationrulethatcreatesanAndTaskforeveryconcurrentCompositeStateinthesourcemodelexceptforthetopComposite-State<strong>of</strong>theStateMachine.Basically,thepredecessorsrelationisthemechanismusedinthetargetmodelto(dis)allowconcurrency:iftwotasksare<br />

notrelatedbythetransitiveclosure<strong>of</strong>thepredecessorsrelation,theycan<br />

executeconcurrently.Now,thesepotentiallyconcurrenttasksareexecuted<br />

assoonasexecution<strong>of</strong>theirpredecessorshasfinished<strong>and</strong>therequired<br />

resourcesareavailable.Inturn,thisalsoimpliesthatataskcanhavemultiple(concurrent)predecessors.<br />

Collectingpredecessortaskswasalready<br />

discussedinthepreviousparagraph.<br />

ConditionalExecution AsdiscussedinSection7.6, thenormalisedsource<br />

modelusesastatewithtwooutgoingguardedtransitionstospecifyconditionalexecution.Everytwoalternativeconditionalbranchesinasource<br />

modelaremappedtoanOrTaskinthetargetmodel.ThisOrTaskcontains<br />

twosubtasks(iftrue<strong>and</strong>iffalse),whichmaybecomposite<strong>and</strong>representthe<br />

twoconditionallyexecutedbranchesfollowingaStatewithtwooutgoing

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

Saved successfully!

Ooh no, something went wrong!