Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: sargasso on April 04, 2004, 06:49:58 pm
-
???
How do I associate a state machine diagram with a particular element. Even more significantly, can I associate it with a specific attribute of that element.
I am sure I have done this before.
Object X of class X-type can be in one of three states (Busy, Waiting, Free), indicated by attribute "Status".
What I am trying to do is map the methods of X to their applicability in the states.
-
Hi,
why not just place the diagram underneath the element?
Cheers, Thomas
-
That (a class object on the state diagram) was my first reaction too (have used it on a previous, non EA, project).
But that's to obvious.
I think Bruce want's some formal association between the state machine diagram and the class object.
I've looked into it today but could not find any way to link a state machine to a class.
Cheers,
Oscar
-
That's what we do - create a child diagram underneath the class.
Bruno
Hi,
why not just place the diagram underneath the element?
Cheers, Thomas
-
I have tried "placing it under the class" in the project tree and this results in correct generation of code (C#) using state subclassing.
This is fine - however, if I want to implement using a state variable, there is no way (?) to indicate/force that approach except by separating the state diagram and the class in the tree (e.g. by putting the state diagram under an instance object.)
My real problem is this. In the state diagram I want to specify certain methods of the class as event handlers and other actions. EA (4) doesn't seem to allow me to select predefined methods for this purpose.
Similarly, methods added to the class states directly in the state diagram dont show up in the class diagram.
Any ideas?
Bruce
-
When the statechart is placed under the class in the project tree you can pick variables from the class attributes when setting the "run state" of a state element.
So EA 'knows' the class attributes.
Haven't found a way to do the same for operations (fi. like in a sequence diagram).
Maybe it's a bug or a feature request.
Oscar
-
Try dragging the operations from the class in the tree to the state element in the diagram.
-
You bloody rippers Oscar and Marcello! :D
-
Thanks Marcello
You opened up my mind. Gues I was playing by the rules to much ;)
But from a pure point of view I still can't appriciate it.
I would like to have the operations on the transition flow and not in the state element.
Another drawback is that the operations in the state diagram are not coupled to the operations in the class(diagram). When you change the operation-name in the class the name in the state element does not change.
The same applies to class-attributes, even if you used the "run state" dialog to define it.
I still would like to see the pick-mechanism as used in the sequence diagram.
Oscar