[Qt-interest] eventTest() and parallel states in QStateMachine
Daniel Zollinger
dh.zollinger at googlemail.com
Mon Feb 14 10:50:43 CET 2011
OK, now I got your point, Thanks a lot!
2011/2/10 <noam.rosenthal at nokia.com>
>
> Right. In that case there's nothing much you can do on the algorithm level.
>
...
> That is if you design your statechart in the way you describe, which counts
> on the assumption that eventTest would be called only once, that is
> apparently not something you can count on :)
>
You're right, but the algorithm could be much more powerful, if someone
could rely on only one invocation of eventTest().
As far as I understand, the problem arises because of the common ancestry of
parallel states. If selectTransition would remember the already handled
states, the transitions would be tested only once.
function selectTransitions(event):
enabledTransitions = new OrderedSet()
+ handledStates = new OrderedSet()
atomicStates =
configuration.toList().filter(isAtomicState).sort(documentOrder)
for state in atomicStates:
if not isPreempted(state, enabledTransitions):
loop: for s in [state].append(getProperAncestors(state, null)):
+ if !handledStates.contains(s):
+ handledStates.add(s)
for t in s.transition:
if t.event and nameMatch(t.event, event.name)
and conditionMatch(t):
enabledTransitions.add(t)
break loop
return enabledTransitions
I'm not familiar with lisp, so I don't know whether or not to delete
handledStates at the end of selectTransitons, but I think you get my point.
:-)
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110214/f059acf8/attachment.html
More information about the Qt-interest-old
mailing list