Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Help! Not understanding state machine diagram to implementation
Help! Not understanding state machine diagram to implementation [message #538349] Mon, 07 June 2010 12:47 Go to next message
Anthony William is currently offline Anthony WilliamFriend
Messages: 6
Registered: June 2010
Junior Member
Hello,

I've been playing with the UML2 and UML2Tools components for a few days now. I can create diagrams with states, triggers, and activities. Then I'm able to use EMF to generate my model code.

But I'm really struggling on understanding how to use the model java classes.

I look at my state machine class and the switch class and all I really see of importance is a doSwitch method. So basically I'm not understanding how this code works to move through states and interact with events, triggers, and activities.

I know that the generated class aren't going to do everything for me and that I will have to write additional code, it's just that I don't see the hooks as to where I would add this code.

Any help or links to previous topics on this (I did do some searching already) would be great.

Anthony
Re: Help! Not understanding state machine diagram to implementation [message #538350 is a reply to message #538349] Mon, 07 June 2010 12:49 Go to previous messageGo to next message
Anthony William is currently offline Anthony WilliamFriend
Messages: 6
Registered: June 2010
Junior Member
I forgot to add that my state machine will be part of a larger java application, if that makes any difference.
Re: Help! Not understanding state machine diagram to implementation [message #538375 is a reply to message #538349] Mon, 07 June 2010 13:30 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, Anthony,

The MDT UML2 project's code generation is only roughly equivalent to the
class diagramming subset of UML. It will generate the structure of
classes, but there is no support for generating behaviour except
inasmuch as in can be specified as OCL or Java-snippet annotations.

If you are using MDT UML2 only, then you will get a Java class (and an
Ecore EClass) generated for your state machine only because a UML state
machine is a kind of class. But the code that is generated will be as
meaningless as the class structure of any state machine.

If you are using some tool that purports to generate behaviour from
state machines, then this is not the right newsgroup.

HTH,

Christian


On 07/06/10 08:47 AM, Anthony William wrote:
> Hello,
>
> I've been playing with the UML2 and UML2Tools components for a few days
> now. I can create diagrams with states, triggers, and activities. Then
> I'm able to use EMF to generate my model code.
>
> But I'm really struggling on understanding how to use the model java
> classes.
>
> I look at my state machine class and the switch class and all I really
> see of importance is a doSwitch method. So basically I'm not
> understanding how this code works to move through states and interact
> with events, triggers, and activities.
> I know that the generated class aren't going to do everything for me and
> that I will have to write additional code, it's just that I don't see
> the hooks as to where I would add this code.
>
> Any help or links to previous topics on this (I did do some searching
> already) would be great.
>
> Anthony
Re: Help! Not understanding state machine diagram to implementation [message #538778 is a reply to message #538375] Tue, 08 June 2010 15:32 Go to previous message
Anthony William is currently offline Anthony WilliamFriend
Messages: 6
Registered: June 2010
Junior Member
Hello Christian,

Thank you for the quick reply. It does indeed help. I also think it made much more sense after I had found this link too.

http://www.eclipse.org/articles/Article-FromFrontendToCode-M DSDInPractice/article.html

This article helped me to put a much more visual perspective on your comment about the state model not containing behavior.

I now understand that I define the state machine meta-model via UML2. The output from that is used as input to an Eclipse Modeling Framework (EMF) project or an Eclipse Graphical Modeling Framework (GMF) project. The output of either of those projects is an editor plugin that I can THEN use to define the behavior of my state machine.

Or at leasts that how I think it is supposed to work. Smile

Anthony.

[Updated on: Tue, 08 June 2010 15:34]

Report message to a moderator

Re: Help! Not understanding state machine diagram to implementation [message #628503 is a reply to message #538375] Tue, 08 June 2010 15:32 Go to previous message
Anthony William is currently offline Anthony WilliamFriend
Messages: 6
Registered: June 2010
Junior Member
Hello Christian,

Thank you for the quick reply. It does indeed help. I also think it made much more sense after I had found this link too.

http://www.eclipse.org/articles/Article-FromFrontendToCode-M DSDInPractice/article.html

This article helped me to put a much more visual perspective on your comment about the state model not containing behavior.

I now understand that I create the state machine model via UML2. The output from that is used as input to an Eclipse Modeling Framework (EMF) project or an Eclipse Graphical Modeling Framework (GMF) project. The output of either of those projects is an editor plugin that I can THEN use to define the behavior of my state machine.

Or at leasts that how I think it is supposed to work. :)

Anthony.
Previous Topic:Help! Not understanding state machine diagram to implementation
Next Topic:Must the stereotype of an Object in UML match the stereotype for its Class' stereotype ?
Goto Forum:
  


Current Time: Fri Apr 19 08:23:30 GMT 2024

Powered by FUDForum. Page generated in 0.02689 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top