|
It is currently Wed Feb 08, 2012 4:42 pm
|
View unanswered posts | View active topics
| Welcome |
|
Welcome to RHAPSODY4YOU
You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, respond to polls, upload and download content, and access many other special features. Registration is fast, simple, and absolutely free, so please, register to join our community today. |
 |
|
 |
|
| Author |
Message |
|
Nizztos
|
Post subject: Combinging junction and condition in state chart? Posted: Mon Feb 08, 2010 11:58 am |
Joined: Thu Feb 04, 2010 12:00 pm Posts: 44
|
|
I'm would like to have several events that take me from one state to another. However, I want to add a condition that decides which of two states I will end up in.
I can't join several transitions into a condition and I can't transition from a junction into a condition. I could put a state instead of the junction, but as I understand it I might miss an event that was meant to take me from one of the new states to another state as it could be consumed by this new state. Or will the null transition prevent the "junction state" from consuming an event?
Any other ways of doing this? Don't want to add the condition to every event as ther might be quite a few of them.
The reason for the multiple events is that every state will transition to a new state based on a subset of events. Some have several and some only one, but there is no good way to combine them into one event per transition.
Hopefully the image shows what I want to accomplish.
| Attachments: |

chart.jpg [ 10.61 KiB | Viewed 453 times ]
|
|
|
|
|
 |
|
Farquad
|
Post subject: Re: Combinging junction and condition in state chart? Posted: Tue Feb 09, 2010 6:15 pm |
Joined: Thu Sep 13, 2007 7:34 pm Posts: 397 Location: London
|
|
This is the only way I know of doing it.
| Attachments: |
File comment: State

state.png [ 3.8 KiB | Viewed 423 times ]
|
|
|
|
|
 |
|
Nizztos
|
Post subject: Re: Combinging junction and condition in state chart? Posted: Fri Feb 12, 2010 7:27 am |
Joined: Thu Feb 04, 2010 12:00 pm Posts: 44
|
|
Thats the way I ended up doing it. I don't particulary like it as state_2 in the above pic could potentialy consume an event that was meant for state_0 or state_1 thus missing that event.
|
|
|
|
 |
|
Farquad
|
Post subject: Re: Combinging junction and condition in state chart? Posted: Sat Feb 13, 2010 9:00 pm |
Joined: Thu Sep 13, 2007 7:34 pm Posts: 397 Location: London
|
|
Yes, it's not ideal but you need not fear that state_2 could consume an event.
If you look at the processEvent operation in OMReactive in the oxf model you'll see that it calls runToCompletion after processing the received event which in turn calls hasWaitingNullTransitions which will take you from state_2 to the next state before returning to processing the event queue.
Here's the processEvent implementation (7.5.1)
// the first received event, needs to perform runToCompletion(), // if in startBehavior() shouldCompleteStartBehavior() returned true. // for any other event shouldCompleteStartBehavior(), should return false. if (shouldCompleteStartBehavior()) { setCompleteStartBehavior(false); // protect from recursive Triggered Operation calls setBusy(true); runToCompletion(); // end protection from recursive Triggered Operation calls setBusy(false); }
// check that this is not the dummy OMStartBehaviorEvent event IOxfReactive::TakeEventStatus res = eventNotConsumed; if (ev->getId() != OMStartBehaviorEventId) { if (!isBusy()) { // protect from recursive Triggered Operation calls setBusy(true); // Store the event in the OMReactive instance setCurrentEvent(ev); // consume the event res = rootState_processEvent(); // take null transitions (transitions without triggeres) if (shouldCompleteRun()) { runToCompletion(); } // notify unconsumed event if (res == eventNotConsumed) { handleNotConsumed(ev, IOxfReactive::EventNotHandledByStatechart); } // done with this event setCurrentEvent(NULL); // end protection from recursive Triggered Operation calls setBusy(false); } else { handleNotConsumed(ev, IOxfReactive::StateMachineBusy); } } else { // the start behavior event is consumed by taking the 0 transitions // therefore it is always consumed res = eventConsumed; } return res;
|
|
|
|
 |
|
Nizztos
|
Post subject: Re: Combinging junction and condition in state chart? Posted: Sun Feb 14, 2010 10:06 am |
Joined: Thu Feb 04, 2010 12:00 pm Posts: 44
|
Thanks, Well, in that case I can stop worrying and go with the current solution  Not pretty, but as long as it does what I want it to do, I'm happy.
|
|
|
|
 |
|
|
 |
|
 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|