Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composite State Machine #1499

Open
mheng86 opened this issue Sep 7, 2019 · 1 comment

Comments

@mheng86
Copy link

commented Sep 7, 2019

When the composite state in the state machine contains concurrency, the concurrent state machines are not drawn correctly, this issue happens when the composite state has completion transition (transition without any event.

Give the minimum Steps to Reproduce

1- Copy and paste the following Umple code to Umple online

class A
{
  Sm {
    s1_S {
       -> FINs1;
        s4_r6 {
          e10 -> s5_r1;
        }
        final s5_r1 {        }
    ||
        s6_r2 {
          e11 -> s7_r5;
        }
        final s7_r5 {        }
    }
    FINs1 {
      do { r2.fm1(); } -> PRELs2;
    }
    PRELs2 {
      fm0 -> s2_S;
    }
    s2_S {        s7_r1 {
          e12 -> s8_r8;
        }
        final s8_r8 {        }
    ||
        s9_r2 {
          e13 -> s10_r5;
        }
        final s10_r5 {        }
    }
  }
}

Actual Result

The composite state s1_s was not drawn correctly
Also the transition fm0 between PRELs2 and s2_s was not in the right location

@TimLethbridge

This comment has been minimized.

Copy link
Member

commented Sep 8, 2019

@mheng86 I think what you are trying to achieve is that when both s4_r6 and s6_r2 are reached, then go to FINs1

This is essentially a duplicate of #1033 and is related to the earlier closed #140. So I will mark it as duplicate and close it. I give a workaround at the end of this comment.

Currently Umple's semantics are that 'final' means 'end the state machine as a whole'.

Current Umple semantics are that autotransitions (as in line 5) have priority.

The problem with the example above is that there is s1_s has an immediate auto-transition to FINs1 on line 5. So as the warnings (reproduced below) state, the transitions to sr_r1 and s7_r5 are ignored, as they cannot ever be invoked.

Warning on line 7 : Transition e10 will be ignored due to an unguarded duplicate event. More information (54)
Warning on line 12 : Transition e11 will be ignored due to an unguarded duplicate event. More information (54)
Warning on line 9 : State 's5_r1' from StateMachine 's4_r6' is non-reachable.. More information (67)
Warning on line 14 : State 's7_r5' from StateMachine 's6_r2' is non-reachable.. More information (67)

Image from Umple model

The 'final' keyword in states does not mean in the Umple context, when this is reached, do the autotransition. I think that was what you were expecting. It means 'delete' the object. There has been a lengthy trail of discussion about this. There was the idea to create a 'done' keyword that would do a transition when all state machines reach and end state.

The issue of the fm0 transition is a separate one; it is lacking a 'tail' but it seems in the right position.

Here is the workaround for the main part of this issue:

class A
{
  Boolean s5r1done = false;
  Boolean s7r5done = false;
  Boolean s1sdone = {s5r1done && s7r5done}
  Sm {
    s1_S {
        s4_r6 {
          e10 -> s5_r1;
        }
        s5_r1 {
          entry / {s5r1done = true;}
          [s1sdone]  -> FINs1;
        }
    ||
        s6_r2 {
          e11 -> s7_r5;
        }
        s7_r5 {        
          entry / {s7r5done = true;}
          [s1sdone]  -> FINs1;
        }
    }
    FINs1 {
      do { r2.fm1(); } -> PRELs2;
    }
    PRELs2 {
      fm0 -> s2_S;
    }
    s2_S {        s7_r1 {
          e12 -> s8_r8;
        }
        final s8_r8 {        }
    ||
        s9_r2 {
          e13 -> s10_r5;
        }
        final s10_r5 {        }
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.