Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Support for Final state and End state in Umple along with Done and automatic transition. #140
Originally reported on Google Code with ID 240
Umple current status:
Umple currently specifies that a final state is any state in the state machine without
UML 2.4 specifications:
According to UML specifications, when a final state is entered, it implies that the
Add support for End state and Final state.
An End state is a state without any outgoing transitions. End states can not have entry
A Final state means that the whole state machine terminates. Termination means that
Reported by @obahy on 2011-10-13 16:46:21
I suggest just
event -> final;
where final becomes a keyword for an end state. There would be no behavioural difference
However what if a second concurrent region transitions out of the region to an entirely
There will have to be lots of test cases to get this right
Reported by @umple on 2011-10-13 19:24:18
We have also agreed to add another keyword done that is actually a real state that can
Done will work as follows:
We will add automatic outgoing transitions ( transitions without any event on it)
If there is an automatic transition then a transition to Done will cause this to be
In the case of a state with concurrent regions. then the automatic transition will
There will be a warning if there is a transition to Done without the presence of any
Done is not syntactically shown as a state, so there can be no entry actions, exit
Reported by @umple on 2012-02-15 17:58:55
@vahdat-ab Here is my research into the semantics of final states so far:
It was difficult to find exact semantics for final state, but I found the following definitions. The search term combinations I used included "what is a final state in a uml state machine", "uml statemachine final state semantics".
UML 2.5 Specification
In Umple, when a transition’s next state is the
When a nested state machine has a state that is prefixed with the keyword
If we decide that entry actions are no longer valid, should we have Umple only provide the
Currently, when a concurrent state machine enters its final state, it deletes the entire state machine. It does not wait for the other concurrent state machines to enter their final states. Generating Java code for my example below demonstrates this.
So far, it seems that we should update how final states are handled for concurrent state machines. For non-concurrent state machines, I believe that the current implementation is correct, asides from deciding if entry actions are still allowed. However from #152 , I am unsure if only the exit action of the current state that initiates the transition to the final state is executed, or if it the exit actions of parent states should also be executed. With the fix for #935, the exit actions of parent states are executed. I am wondering where to go from here?
@jblang94 Thanks. great job.
This is from UML 2.5
There are two meanings for final states. One used for regions and one for the entire state machine. In Umple, the first one is satisfied through the keyword
Regarding having entry actions for
However, we cannot have entry actions for
@TimLethbridge You may want to comment on this as well
I don't mind going slightly against UML and keep entry actions on final states. The very big benefit is that it allows such things as notifying of clients to shut down, or outputting the state change to the UI before termination. These things are supposed to be 'instantaneous', so there is essentially no harm in such entry actions, only benefit.
I am content with the semantics as shown in the gist.
Just to be clear that 'delete()' deletes the object (including the sm). As I understand it this would occur on a transition to 'Final'. It would also occur on a transition to a final state in situations where there are no concurrent regions, or if there are concurrent regions then all of them are in the final state.
I acnknowledge @vahdat-ab 's concern. He pointed to a link showing UML semantics that includes regions that can independently reach final states, but not terminate the enclosing state, with a 'completion' transition occurring when all regions do reach their final state. Presumably, the same logic in UML would apply in any nested state (i.e. just one region in a state). The example Vahdat pointed to also shows joins. We have not implemented this sort of thing in Umple currently and it would be a considerable piece of work to do so.
Yup! This is what we've agreed on so far. I will go ahead with this implementation.