예제 #1
0
        private void loadCSPConstraints(MocaNode actNode)
        {
            MocaNode constraintsNode = actNode.getChildNodeWithName(ConstraintsChildNodeName);

            if (constraintsNode != null)
            {
                Constraints.Clear();
                foreach (MocaNode constraintNode in actNode.getChildNodeWithName(ConstraintsChildNodeName).Children)
                {
                    if (constraintNode.Name == DeclarationsChildNodeName)
                    {
                        foreach (MocaNode constraintNodeReal in constraintNode.Children)
                        {
                            CSPConstraint newConstr = new CSPConstraint();
                            newConstr.deserializeFromMocaTree(constraintNodeReal);
                            this.Constraints.Add(newConstr);
                        }
                    }
                    else if (constraintNode.Name == ConstraintInstancesChildNodeName)
                    {
                    }
                    else
                    {
                        CSPConstraint newConstr = new CSPConstraint();
                        newConstr.deserializeFromMocaTree(constraintNode);
                        this.Constraints.Add(newConstr);
                    }
                }
            }
            CSPUtil.addDefaultConstraints(Constraints);
            this.Constraints.Sort(new CSPConstraintComparer());
            CSPUtil.recomputeConstraintIndizes(Constraints);
        }
예제 #2
0
        public TGG(SQLRepository repository, SQLPackage tggSchemaPackage) : base(tggSchemaPackage, repository)
        {
            this.Name  = tggSchemaPackage.Name;
            TGGRules   = new List <TGGRule>();
            Metamodels = new List <Metamodel>();
            Domains    = new List <Domain>();

            Constraints = new List <CSPConstraint>();
            CSPUtil.addDefaultConstraints(Constraints);
        }
예제 #3
0
        public override void addAttributesDuringExport(MocaNode pkgNode)
        {
            base.addAttributesDuringExport(pkgNode);

            List <CSPConstraint> tempList = new List <CSPConstraint>();

            CSPUtil.addDefaultConstraints(tempList);

            MocaNode constraintRootNode = pkgNode.getChildNodeWithName(ConstraintsChildNodeName);

            if (constraintRootNode != null)
            {
                MocaNode declarationsRootNode = constraintRootNode.getChildNodeWithName(DeclarationsChildNodeName);
                if (declarationsRootNode != null)
                {
                    foreach (CSPConstraint constr in tempList)
                    {
                        MocaNode constraintNode = declarationsRootNode.appendChildNode("");
                        constr.serializeToMocaTree(constraintNode);
                    }
                }
            }
        }