from any event or to any event in the fluent api

35 views
Skip to first unread message

mycircuit

unread,
Feb 28, 2014, 5:05:44 PM2/28/14
to squirrel-st...@googlegroups.com
Hi

When using the method call option , I can do things like this:

transitFrom[fromStateName]To[toStateName]On[eventName]When[conditionName]  
transitFrom[fromStateName]To[toStateName]On[eventName]  
transitFromAnyTo[toStateName]On[eventName]  
transitFrom[fromStateName]ToAnyOn[eventName]  
transitFrom[fromStateName]To[toStateName]          
on[eventName] 


Is it possible to achive something like :

transitFromAnyTo[toStateName]On[eventName]

or

   transitFrom[fromStateName]ToAnyOn[eventName]  

with the fluent api ?

Like so :

 builder.externalTransition().from(<ANY>).to(State.FINISHED)
                    .on(Event.WALKDIR_SUCCEEDED).perform(new FinishedAction());


From what I can see in the api doc, this is not possible in a straightforward way. What would be the best way to do this ?

Thanks
mycircuit

He Henry

unread,
Mar 1, 2014, 9:05:53 AM3/1/14
to squirrel-st...@googlegroups.com
That's a good idea. I guess the API will look like this "builder.externalTransition().fromAny().to(State.Target).onAny().perform(someAction)".
Please help me to submit a enhancement issue on Github. I will try to implement in the next coming release.

Thanks,
Henry

在 2014年3月1日星期六UTC+8上午6时05分44秒,mycircuit写道:

He Henry

unread,
Mar 3, 2014, 5:24:47 AM3/3/14
to squirrel-st...@googlegroups.com
Hi, 

This API(builder.transit().fromAny().to("B").on("ToB").callMethod("transitFromAnyToBOnToBEx");) has been implemented. code here.
The latest snapshot includes this changes. You can have a try. :)

Thanks,
Henry

在 2014年3月1日星期六UTC+8上午6时05分44秒,mycircuit写道:
Hi
Reply all
Reply to author
Forward
0 new messages