Basic Composite Structure Diagrams
[Previous]  [Next] 
|
User Manual [Previous]  [Next] Basic Composite Structure DiagramsA composite structure diagram is used to show how various instances of classes, called parts, are connected at run time in order to communicate with each other. To specify composite structure, the following are the elements that need to be present in an Umple system:
The example below first defines two classes with ports; a third class contains instances of the first two. Under development: Composite structure diagrams, ports and active methods are currently under development. Code generation only works in C++ See also the Wikipedia page on Composite Structure Diagrams. Example// Example system representing constraint-based ping-pong example // Demonstrates the composite Structure Diagram in Umple class Component1 { // Relay-Port public in Integer pIn1; public out Integer pOut1; pIn1 -> pOut1; [pIn1] active increment { pOut1(pIn1 + 1); } [pOut1] active logOutPort1 { cout << "CMP 1 : Out data = " << pOut1 << endl; } } class Component2 { public in Integer pIn2; public out Integer pOut2; pIn2 -> pOut2; [pIn2, pIn2 < 10] active stop { pOut2(pIn2 + 1); } [pOut2] active logOutPort2 { cout << "CMP 2 : Out data = " << pOut2 << endl; } } class Atomic { Component1 cmp1; Component2 cmp2; Integer startValue; after constructor { cmp1->pIn1(startValue); } cmp1.pOut1 -> cmp2.pIn2; cmp2.pOut2 -> cmp1.pIn1; } Load the above code into UmpleOnline SyntaxprimitiveDefinition : primitive [name] { [[primitiveBody]]* } portMultiplicity : [!portMultiplicity:\[[0-9]+\]] typedPortName : [~type]? [~portName] [[portMultiplicity]]? portDefinition : [[portClass]] | [[portDeclaration]] // Port Connectors portBindingDefinition :  ( [~fromClassname] .  )? [fromPort] ->  ( [~toClassname] .  )? [toPort] [[bindinHandler]] bindinHandler : { [**code] } | ; // Port Watchlist Definition portWatch- :  ( [[constraintList]] | [[comment]] | [[reqImplementation]]  )* // Active Method Definition activeMethodDefinition : [[portWatch]]? [=modifier:public  |protected  |private]? [type]? [=activeType:atomic  |synchronous  |intercept]? [=active] [[activeMethodDeclarator]] [[activeMethodBody]]+ activeMethodDeclarator : [~methodName] [[parameterList]]? //activeMethodBody : [[activeDirectionHandler]] { ( [[activeTrigger]] )* [**code] } activeMethodBody : [[activeMethodBodyContent]] [[inverseDirectionHandler]]? activeTrigger : [[hitchConstraint]]? [[constraintList]]? [=trigger:/] [[activeTriggerBody]] [[thenDefinition]]? [[resolveDefinition]]? activeTriggerBody- :  ( [[deferredList]] | [[activeTriggerDefinition]]  ) deferredList : [ [[activeTriggerDefinition]]  ( , [[activeTriggerDefinition]]  )* ] activeTriggerDefinition- : [[anonymousTriggerBody]] | [[invoke]] thenDefinition : .then ( [[anonymousTriggerBody]]? ) resolveDefinition : .resolve ( [[anonymousTriggerBody]]? ) hitchConstraint : [=clause:after|poll] ( [timer] ) constraintList : [ [[basicConstraint]]  ( , [[basicConstraint]]  )* ] basicConstraint- : [[timeConstraint]] | [[messageConstraint]] | [[constraint]] timeConstraint : [=clause:latency|period|timeout] ( [timer] ) messageConstraint : [=clause:priority] ( [priorityValue] ) invoke :  ( [~classname] .  )? [name] (  ( [parameter]  ( , [parameter]  )*  )? ) ; anonymousTriggerBody : { [**code] } |