-
1. Re: signal and default transition
kukeltje Dec 2, 2005 11:59 AM (in response to icyjamie)Can you explain a little more? I completely miss the point you are trying to make....e.g. 'a decision handler for evey node type'???
-
2. Re: signal and default transition
icyjamie Dec 5, 2005 1:55 AM (in response to icyjamie)"some sort of" decision handler.
I mean that, when you do a signal without a transition name, it will do a getDefaultLeavingTransition on the node (check the sourcecode for this). It would be nice if this function also calls a handler, similar to a DecisionHandler, which returns the name of the transition that should be consequently used in the signal.In token: public void signal() { if ( (node == null) || (node.getDefaultLeavingTransition() == null)) { throw new IllegalStateException("couldn't signal token '" + this + "' : couldn't leave node '" + node + "' over its default transition"); } signal(node.getDefaultLeavingTransition()); } In node: public Transition getDefaultLeavingTransition() { Transition defaultTransition = null; if ( (leavingTransitions!=null) && (leavingTransitions.size()>0) ) { // here you could check for the existence of a handler, and use this // if it returns null, you could still use the rest of the code, giving back the first one defaultTransition = (Transition) leavingTransitions.get(0); } else if ( superState!=null ){ defaultTransition = superState.getDefaultLeavingTransition(); } return defaultTransition; } ....
-
3. Re: signal and default transition
icyjamie Dec 5, 2005 2:02 AM (in response to icyjamie)I was following the other thread concerning transitions, guards and the like (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=73286)
Of course, you could also use guards on transitions, filter the ones that are available, and choose the first one (hopefully, in this case, there will be only one available, otherwise, you have to choose the first one again, or fire an exception).
In other words, guarded or conditional transitions seems like a hot topic.