Web designer and loop support

41 views
Skip to first unread message

vishal gaurav

unread,
Feb 3, 2015, 7:12:04 AM2/3/15
to squirrel-st...@googlegroups.com
Hi,
I have just started with Squirrel and trying to evaluate if this fits in my requirement. Basically I am looking for two features and just wanted to just the group if they can help me with that.

1. Parallel states : One state having list of data cab be split into multiple states or loop over a single state for all data untill exit condition (exhausted list) met.
2. I would like to have web editor where user can draw these transitions or create one using the drop downs like actions, states , events but should be able to see the visualization of transitions.Once completed they can send over the transition definition which I can load in squirrel.

I am not sure about 1. but 2nd I think I can implemented by some JS library creating scxml and then load that scxmal in squirrel.

Thanks for help in advance. 

He Henry

unread,
Feb 3, 2015, 8:24:47 AM2/3/15
to squirrel-st...@googlegroups.com
The quick answer for 1st question is squirrel state machine supports parallel states. You can refer document on github.
If you have specific issue/requirement on parallel states, you can submit a issue on github.


在 2015年2月3日星期二 UTC+8下午8:12:04,vishal gaurav写道:

vishal gaurav

unread,
Feb 4, 2015, 12:45:21 AM2/4/15
to squirrel-st...@googlegroups.com
Thanks Henry !!!! This seems very impressive.
Though it looks like it all in memory,  what happen in case of termination ? The state information will loose. Isn't it ?

He Henry

unread,
Feb 4, 2015, 1:02:10 AM2/4/15
to squirrel-st...@googlegroups.com
State machine data can be persisted. You can refer to this test case. >>>

在 2015年2月4日星期三 UTC+8下午1:45:21,vishal gaurav写道:

vishal gaurav

unread,
Feb 4, 2015, 6:50:01 AM2/4/15
to squirrel-st...@googlegroups.com
Yeah !!!! Thanks a lot .... so far so good.

I am struggling to implement loop transition. where the loop is based on context data. For e.g. I have state A , on state A fire an even by passing a list of object as context. Now next states i.e. State B and C  will be transit for each object in list.

from B to C for each object then move back to B until the list is exhausted.   

I know squirrel very much support this but I am not able to figure out how. Can you please help me with this.
Message has been deleted
Message has been deleted

vishal gaurav

unread,
Feb 4, 2015, 7:23:45 AM2/4/15
to squirrel-st...@googlegroups.com
I have currently done this using local transition along with a condition. Is it correct ? I think I should use StateCompositeType as sequential or parallel.

He Henry

unread,
Feb 9, 2015, 9:46:45 AM2/9/15
to squirrel-st...@googlegroups.com
From your description, it is more like functional programming paradigm (you may try RxJava), not sure whether it is suitable for state machine to solve.

在 2015年2月4日星期三 UTC+8下午7:50:01,vishal gaurav写道:

vishal gaurav

unread,
Feb 10, 2015, 5:34:03 AM2/10/15
to squirrel-st...@googlegroups.com
Thanks !!! I have achieved the looping and backward movement by storing state Context data as instance variable in state machine.

In my case there could be multiple state machine instances running each having map as state machine data. I want to persist each instance  along with data in database, so that I can query them later. 

Also how should I persist the state transition definition ? If JVM terminates I loose the builder instance, now how can I create new state machine instances also how can I  get the definition back.

Thanks
-Vishal

He Henry

unread,
Feb 10, 2015, 5:45:56 AM2/10/15
to squirrel-st...@googlegroups.com
Well, you can try state machine importer. >>>
First you need to export state machine definition to somewhere persisted, and then you can reimport state machine definition and recreate the state machine builder.

在 2015年2月10日星期二 UTC+8下午6:34:03,vishal gaurav写道:

vishal gaurav

unread,
Feb 10, 2015, 6:07:14 AM2/10/15
to squirrel-st...@googlegroups.com
Thanks I don't know how I forgot scxml. I was much into dot file for rendering into HTML page that I almost forgot about scxml export. Thanks a ton !!! 
I am advancing with your help :)


On Tuesday, 3 February 2015 17:42:04 UTC+5:30, vishal gaurav wrote:
Reply all
Reply to author
Forward
0 new messages