<?xml version="1.0" encoding="UTF-8"?>
<diagram author="Yentl Van Tendeloo" name="broken">
    <description>
        Broken!
    </description>

    <class name="A" default="true">
        <relationships>
            <association name="child" class="B" min="0" max="1"/>
        </relationships>

        <scxml initial="x">
            <state id="x">
                <onentry>
                    <raise scope="cd" event="create_instance">
                        <parameter expr="'child'"/>
                        <parameter expr="'B'"/>
                    </raise>
                </onentry>

                <transition event="instance_created" target="../ready">
                    <parameter name="instancename"/>
                    <script>
                        self.instancename = instancename
                        print(self.instancename)
                    </script>
                </transition>

            </state>
            <state id="ready">
                <onentry>
                    <raise scope="cd" event="start_instance">
                        <parameter expr="self.instancename"/>
                    </raise>
                </onentry>

                <transition event="close" target="../done">
                    <script>
                        print("CLOSED")
                    </script>
                    <raise scope="cd" event="delete_instance">
                        <parameter expr="self.instancename"/>
                    </raise>
                </transition>

            </state>
            <state id="done"/>
        </scxml>
    </class>

    <class name="B">
        <constructor>
            <body>
                print("READY")
            </body>
        </constructor>

        <relationships>
            <association name="parent" class="A" min="1" max="1"/>
        </relationships>

        <scxml initial="z">
            <state id="z">
                <onentry>
                    <script>
                        print("RUN")
                    </script>
                </onentry>
                <transition after="0" target=".">
                    <script>
                        print("RAISE")
                    </script>
                    <raise scope="broad" event="close"/>
                </transition>
            </state>
        </scxml>
    </class>

</diagram>
