Sparx Systems Forum

Enterprise Architect => Uml Process => Topic started by: ceatley on October 14, 2004, 05:13:27 pm

Title: state machine model problem
Post by: ceatley on October 14, 2004, 05:13:27 pm
I have two state sets in a class.  One state is a mode state that indicates if the object is in read, modiify, add or delete mode.  The other state set indicates some other status.  
There are 3 states in the second set.  This gives a possible product of 12 possible combined states, not all of which are possible.

How do I model a state machine where the state of both sets determines the available transitions?

I thought that a concurrent state model might be the answer, but it doesn't seem to go together right.   Another possible answer is to use one of the states as a guard.  Or, possibly have states such as: Delete and x1; Add and x2; etc;

None of the books that I have read cover the possibility of more than one set of states in a state machine.

Anyone have any ideas on how to model this?
Title: Re: state machine model problem
Post by: Oscar on October 15, 2004, 12:36:01 am
Two ideas.

Idea 1  State-sets depend (strongly) upon each other

Make a state-machine for the 12 states ("Delete and X1", "Delete and X2",  "Delete ans X3", Ädd and X1",  .....)


Idea 2 State-sets don't depend (or slightly) upon each other

Make a state-machine with composed- and enclosed(sub) states.
Use the most discrimitive state-set for the composed states and the other set for the sub-states.

Some sub-state may occur in more then one composed-state.


HTH
Oscar
Title: Re: state machine model problem
Post by: ceatley on October 15, 2004, 09:18:20 am
Idea one is the one I am trying to avoid.

Idea two looks good, but seems to only work if a transition in a submachine state leaves the owning state the same.  If the composite state was "X1, Add" and a signal was received from a 'Save' button then the next composite state might be "X2, Read".  This requires that the parent state transition as well as the submachine state.  The transition at the parent diagram would appear to be valid for all submachine states.

Just trying to write this scenario down makes me think that I am going to have to go with idea 1 and make my states something like "X1,Add" "X2,Read", etc.

Anyone, please give me a better idea if possible.
Title: Re: state machine model problem
Post by: Dani on October 21, 2004, 03:13:55 am
Why can't you use idea 2 and force a direct transition from say substate1 in superstateA into substate2 within superstateB ? Surely it all depends on how you implement your state machines.
Title: Re: state machine model problem
Post by: ceatley on October 21, 2004, 12:31:09 pm
Is a transisition from a submachine state in one parent state to another submachine state in a second parent state UML compliant?

The only modeling problem seems to be drawing this solution.  If you use a composite parent state then the submachine states are not visible at the parent level.  And the submachines are in different diagrams.  So once again you have to model the transisition at the parent level. And this gives the appearance that the submachine state doesn't matter.

Once more we are back to using either a composit state name such as: "X!,Add".  or using the submachine state as a guard on the transition.

If you extend the cross product to include additional co-dependent  state sets then the problem quickly gets out of hand.
Title: Re: state machine model problem
Post by: TrtnJohn on November 10, 2004, 12:42:07 pm
Would using multiple state transitions with guards on only one set of states be any better?  (I am not sure what are the valid transitions)