Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic Rhapsody (steve huntington)
Decrease font size
Increase font size
Topic Title: [statecharts] why does Rhapsody have "two logical states" for one substate?
Topic Summary:
Created On: 14-May-2008 09:34
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 14-May-2008 09:34
User is offline View Users Profile Print this message


Michael Lettner

Posts: 16
Joined: 7-Dec-2007

Hello all,

I'm working with Statecharts in RiC 7.0, and was wondering if somebody else has also experienced this weird behavior:

imagine you have a substate in your statechart - it appears on two diagram levels: the parent diagram level and the child diagram level (see screenshot below)

the odd thing now is, that you can have different entry actions for both states - although logically it should only be a single substate, shouldn't it? (so a change in one entryAction should be reflected in the other and vice-versa).

If you generate default-code for the statechart, only the entryAction from the "outer state" (on parent level, the left side in the screenshot) is reflected in code - the second one is ignored - which is acceptable.

However, the real problem arises when I try to customize the generated code using Simplification (via COM Rhapsody API):
if for any a child-state (e.g. state_218 in screenshot), I set the entryAction of its parent (which is the "ParentState" in screenshot), by:
_stereotypedState.parent.entryAction = "NewEntryAction()";

--> the "NewEntryAction()" is only set on child-level (in right side of screenshot) --> as described above, when we run default-code-generation now, this newly set entryAction is totally ignored (means, "NewEntryAction()" never appears in actual code).


my questions:
- has anybody ever experienced similar behavior?
- does Rhapsody really handle a single substate more or less as two different states during code-generation?
- is there another method in Rhapsody-COM-API, how I can set the correct parent-entryAction? (= set the entryAction in left side of screenshot)


Report this to a Moderator Report this to a Moderator
 14-May-2008 09:39
User is offline View Users Profile Print this message


Michael Lettner

Posts: 16
Joined: 7-Dec-2007

I should add, that setting the entryAction on the child-diagram level is usually only possible, if the Features-dialog is shown permanently (means, if Features dialog is not visible before, and you just double-click the substate on child-level, no Feature dialog opens).

This is probably intended so that the entryAction can only be changed on parent-level. However, I said that I set the entryAction during code-customization-step, and there it is always set on child-level as mentioned above :-(
Report this to a Moderator Report this to a Moderator
 16-May-2008 08:06
User is offline View Users Profile Print this message


Simon Morrish

Posts: 127
Joined: 17-May-2005

Hi Michael!

Yes; ParentState and its eponymous proxy-in-its-sub-statechart are, apparently, completely different states. I've hit this issue when reporting on nested statecharts using ReporterPlus.

To navigate from a state down to its proxy-in-its-sub-statechart, you need to do:

ParentStateProxy = ParentState.nestedStatechart.rootState.subStateVertices.Items(1)

Conversely, to navigate from your state_218 to its REAL parent state, you need to do:

ParentState = state218.parent.parent.itsStatechart.owner

(Of course, both these expressions could do with breaking out into code that traps the various null objects that could be returned halfway through; they are for illustration only you understand! )

I hope that helps...

best regards,
Simon

PS. Loading your model into ReporterPlus and using its navigator to browser the model hierarchy can sometimes be helpful. Just bear in mind that ReporterPlus's model does not precisely match the COM API.

-------------------------
Simon Morrish
simon.morrish@eu.panasonic.com
http://panasonic.co.uk
Panasonic ideas for life
Report this to a Moderator Report this to a Moderator
 20-May-2008 10:05
User is offline View Users Profile Print this message


Michael Lettner

Posts: 16
Joined: 7-Dec-2007

Hi Simon,

thanks for your reply.

The suggested workaround worked fine for me.
(except for substates on the highest level, which only have the "proxy-state", but not the real parent state drawn in the diagram (the owner is of type IRPClass instead of IRPState there) - but the normal "state.parent"-accessor worked in this case of course)

Can you also think of a way to directly check whether a state is the "real parent", or just the "proxy-in-its-sub-statechart"?
(otherwise, if I generate code for the entry actions of states marked with <<myStereotype>>, the entryActions for both the "real parent" and the "proxy parent" are filled (however, it doesn't have any influence on the generated code; it's just not "beautiful").

Best Regards,
Michael
Report this to a Moderator Report this to a Moderator
 21-May-2008 16:26
User is offline View Users Profile Print this message


Simon Morrish

Posts: 127
Joined: 17-May-2005

Hi Michael

I don't know of a handy property to check if a state is a "proxy". I think the following check should be accurate, though:

'Test if a state is the top level in a sub-statechart
If stateTocheck.parent.parent Is Nothing And _
TypeName(stateTocheck.itsStatechart.owner) = "IRPState" Then
MsgBox stateTocheck.name & " is a proxy state!"
End If

Do you think that covers it?
best regards,
Simon

-------------------------
Simon Morrish
simon.morrish@eu.panasonic.com
http://panasonic.co.uk
Panasonic ideas for life
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic Rhapsody forum.
There are currently 1 users logged in.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.