示例#1
0
        internal HashSet <UML_SM.Vertex> createVertices
            (BehaviorStateMachines.Region region
            )
        {
            HashSet <UML_SM.Vertex> newVertices =
                new HashSet <UML_SM.Vertex>();

            global::EA.Element parentElement = region.wrappedElement;
            foreach (global::EA.Element childElement in parentElement.Elements)
            {
                UML_SM.Vertex newVertex = null;
                switch (childElement.Type)
                {
                case "State":
                case "StateMachine":
                case "StateNode":
                    newVertex = createEAElementWrapper(childElement) as UML_SM.Vertex;
                    break;
                }
                if (newVertex != null)
                {
                    if (region.isContainedElement(newVertex as ElementWrapper))
                    {
                        newVertex.container = region;
                        newVertices.Add(newVertex);
                    }
                }
            }
            return(newVertices);
        }
示例#2
0
        createBehaviourStateMachineRegions(ElementWrapper elementWrapper)
        {
            HashSet <UML.StateMachines.BehaviorStateMachines.Region> newRegions =
                new HashSet <UML.StateMachines.BehaviorStateMachines.Region>();
            // Get the owning element
            ElementWrapper owningElement = getOwningElement(elementWrapper);

            global::EA.Diagram masterDiagram = null;
            if (owningElement != null)
            {
                // Get the master state diagram from the owning element if available
                masterDiagram = getMasterStateDiagram(owningElement, elementWrapper.wrappedElement);
            }
            if (masterDiagram == null)
            {
                // Get the master state diagram from the current element if available
                masterDiagram = getMasterStateDiagram(elementWrapper, elementWrapper.wrappedElement);
            }

            if (elementWrapper.wrappedElement.Partitions.Count == 0)
            {
                // Check if the wrapped element contains any sub states
                if (elementWrapper.wrappedElement.IsComposite || elementWrapper.wrappedElement.Type == "StateMachine")
                {
                    // Create an implicit default region
                    UML.StateMachines.BehaviorStateMachines.Region defaultRegion =
                        new BehaviorStateMachines.Region(this.model as Model, elementWrapper, masterDiagram, null);
                    newRegions.Add(defaultRegion);
                }
            }
            else
            {
                // Create a region for all partitions of the wrapped element
                short regionPos = 0;
                foreach (global::EA.Partition partition in elementWrapper.wrappedElement.Partitions)
                {
                    UML.StateMachines.BehaviorStateMachines.Region newRegion =
                        new BehaviorStateMachines.Region(this.model as Model, elementWrapper, masterDiagram, partition, regionPos);
                    newRegions.Add(newRegion);
                    ++regionPos;
                }
            }
            return(newRegions);
        }