0

In Umple state machines' guards, I'm missing an "in state" predicate that returns true if the state machine is in a given state. Does this function exists?

1 Answer 1

1

Yes, there is. Call the get function on the state machine to get the state, and then compare the result to the enumeration whose name is the state machine followed by a dot followed by the state. See below for an example where a query is being done in method m1()

class X {
  sm {
    s1 {
      a-> s2;
    }
    s2 {}
  }
  
  public m1 () {
    if(getSm()==Sm.s1) {
      // do something
    }
  }
}

It is a good point that this should be documented in the user manual

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.