-1

How would I go about re-using states in Sparx EA State Machine Diagrams?

For my application I have a defined list of States (StateA,StateB,StateC, etc) but different objects may transition between them in different manners, i.e. ObjectA: StateA--(no guard)-->StateB--(input=0)-->StateC ObjectB: StateA--(input=2)-->StateB--(no guard)-->StateC

If I create these states and put them in their own "package", and then create 2 state machine diagrams and copy these states into the diagrams, whenever I make changes to one diagram the other diagram gets (wrongly) updated.

Or am I thinking about this wrong, and essentially every State Machine Diagram needs to have either its own definition of states/transitions (optionally can reuse existing state machines, but I don't think that solves this problem)?

David Gitz
  • 13
  • 3

1 Answers1

-1

Looks like I figured it out. If you right click on the state machine diagram, click "Paste as New" and un-click "Include Connectors" it won't copy the connectors into the new diagram, and if you make a transition on these states the other states won't get their transitions modified.

David Gitz
  • 13
  • 3
  • Though this copy creates something it's indeed gibberish. How can a state be in more than one state machine? A state is only meaningful within a certain state machine. – qwerty_so Jun 07 '21 at 21:19
  • Please read what 14.2.3.4 of UML 2.5 tells about states. – qwerty_so Jun 08 '21 at 20:56
  • Please reread the question. The question was about reusing states in different diagrams. The question even states this "ObjectA" is one state machine, "ObjectB" is another state machine. You are confusing an "instance" of a state machine with the definition of a state. – David Gitz May 10 '22 at 18:47
  • State machines do not depict instances. They are abstract. You can show an object having certain states. – qwerty_so May 11 '22 at 07:57