W3C home > Mailing lists > Public > www-voice@w3.org > October to December 2012

scxml Historic ancestor entry states

From: Carlos Verdes <cverdes@gmail.com>
Date: Tue, 13 Nov 2012 01:03:38 +0000
Message-ID: <CAMZOHDMpBUppzAzA_D8tv1HYonaXOYCqwkzdmKSKgoaSs2J67Q@mail.gmail.com>
To: "www-voice@w3.org" <www-voice@w3.org>
Hi,

I have seen in the entryStates the next code:
http://www.w3.org/TR/scxml/#AlgorithmforSCXMLInterpretation

procedure addStatesToEnter(state,root,statesToEnter,statesForDefaultEntry)
...

    if isHistoryState(state):
        if historyValue[state.id]:
            for s in historyValue[state.id]:
                addStatesToEnter(s,statesToEnter,statesForDefaultEntry)
                *for anc in getProperAncestors(s,state):
                    statesToEnter.add(anc)*


Taking in account the next state machine:
roostate-->r
rootState-->s
s-->h
s-->s1
s-->s2
s2-->s21
s2-->s22

Where h is a historic state and the current configuration is s,s2,s22.
There are two transition, one from s-->r (so the state s22 is saved) and
the other r-->h

If I understood well the proper configuration should be again s,s2,s22
after the 2 transitions.

When we execute the previous snippet we will add first the state s22:

 addStatesToEnter(*s22*,statesToEnter,statesForDefaultEntry)


And after we need to add the proper ancestors, which I understand that are
s2 and s.
But, if we execute the highlighted code what we will obtain?

*getProperAncestors(**s22*,*h*)=root???

*h will be never an ancestor of a saved state, maybe a sibling or an "aunt"*

I think the getProperAncestors should be called with the grandparent of the
history state because the parent of the history state is the parent of the
saved state but is also a state to be entered, so if we want
getProperAncestors to return s2 and s we should change for:

*getProperAncestors(**s,state.parent.parent*)


Tell me what do you thing please.

Best regards,
Carlos Verdes.
Received on Tuesday, 13 November 2012 01:18:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 13 November 2012 01:19:02 GMT