Пример #1
0
        public override MocaNode serializeToMocaTree()
        {
            EClass dummyEClass = new EClass(this.rule, Repository);

            dummyEClass.computeFeatures();
            MocaNode ruleNode = dummyEClass.serializeToMocaTree();

            ruleNode.Name = "Rule";

            MocaNode operationsNode = ruleNode.getChildNodeWithName(EClass.OperationsChildNodeName);
            MocaNode toDelete       = null;

            if (operationsNode != null)
            {
                foreach (MocaNode node in operationsNode.Children)
                {
                    MocaAttribute nameAttr = node.getAttributeOrCreate("name");
                    if (nameAttr != null && nameAttr.Value == this.Name)
                    {
                        toDelete = node;
                    }
                }
            }
            if (toDelete != null)
            {
                operationsNode.Children.Remove(toDelete);
            }

            ruleNode.appendChildAttribute(TGGRule.CspSpecAttributeName, "");
            ruleNode.appendChildAttribute("refines", "");
            ruleNode.appendChildAttribute("baseClasses", "");
            ruleNode.appendChildNode(StoryPattern.ObjectVariablesChildNodeName);

            return(ruleNode);
        }