[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.mdt.uml2] Re: Coupling operations with activities, state machines and actions
|
Hi Rafael
Thanks for replying. The section of the spec (Concrete Syntax for a UML
Action Language) was the appendix - a simple java method and the
corresponding activity diagram. I can see how to generate the class and
the operation, and also generate the activity with CallBehaviourActions.
So, from what you are saying, all I have to do is create the activity
and do a getMethods().add()?
ie:
class ListUtils {
boolean sameSizeLists(List listOne, List listTwo) {
if (listOne.size() == listTwo.size())
return true;
return false;
}
}
Class class = package_.createOwnedClass("ListUtils", isAbstract);
Operation op = class.createOwnedOperation("sameSizeLists", pNames,
pTypes, returnType);
Activity activity = (Activity)
class.createOwnedBehavior("sameSizeLists",
UMLPackage.eINSTANCE.getActivity());
CallBehaviorAction cba0 = (CallBehaviorAction)
activity.createNode(null,UMLPackage.eINSTANCE.getCallBehaviorAction());
... add actions, nodes etc
op.getMethods().add(activity);
.... and then when it comes to traversing the model (for code
generation), look at the methods assigned to the operation and choose
the most appropriate?
Thanks again
Cheers
Nick
Rafael Chaves wrote:
Nick,
Operations can have one or more behaviors (BehavioralFeature#method,
opposite is Behavior#specification). An activity is a kind of behavior.
> For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an activity
> diagram and a matching java method.
What section of the spec are you referring to?
Cheers,
Rafael
Nick Betteridge wrote:
Hi
I'm new to uml2 and modeling, so I hope I don't sound as though I've
really missed the point.
I'm trying to understand how to map activities and state machines to
operations in uml2. I've gone through the tutorials on creating
models, packages, classes, attributes and operations. Now I would like
to take this further and create activities and state machines (with
the states containing actions).
Does anyone know of a simple tutorial which demonstrates how to do
this with uml2?
For instance, http://www.omg.org/docs/ad/07-08-02.pdf shows an
activity diagram and a matching java method. I really would like to
create this model in uml2 and then parse though the model and create
the source.
Am I on the right track here?!
Thanks in advance for any input.
Nick