IfcDoc.Program.ImportMvdRule C# (CSharp) Method

ImportMvdRule() static private method

static private ImportMvdRule ( AttributeRule mvdRule, DocModelRuleEntity>.Dictionary fixups ) : DocModelRule
mvdRule IfcDoc.Schema.MVD.AttributeRule
fixups DocModelRuleEntity>.Dictionary
return DocModelRule
        internal static DocModelRule ImportMvdRule(AttributeRule mvdRule, Dictionary<EntityRule, DocModelRuleEntity> fixups)
        {
            DocModelRuleAttribute docRule = new DocModelRuleAttribute();
            docRule.Name = mvdRule.AttributeName;
            docRule.Description = mvdRule.Description;
            docRule.Identification = mvdRule.RuleID;
            //ImportMvdCardinality(docRule, mvdRule.Cardinality);

            if (mvdRule.EntityRules != null)
            {
                foreach (EntityRule mvdEntityRule in mvdRule.EntityRules)
                {
                    DocModelRuleEntity docRuleEntity = new DocModelRuleEntity();
                    docRuleEntity.Name = mvdEntityRule.EntityName;
                    docRuleEntity.Description = mvdEntityRule.Description;
                    docRuleEntity.Identification = mvdEntityRule.RuleID;
                    //ImportMvdCardinality(docRule, mvdRule.Cardinality);
                    docRule.Rules.Add(docRuleEntity);

                    if (mvdEntityRule.AttributeRules != null)
                    {
                        foreach (AttributeRule mvdAttributeRule in mvdEntityRule.AttributeRules)
                        {
                            DocModelRule docRuleAttribute = ImportMvdRule(mvdAttributeRule, fixups);
                            docRuleEntity.Rules.Add(docRuleAttribute);
                        }
                    }

                    if (mvdEntityRule.Constraints != null)
                    {
                        foreach (Constraint mvdConstraint in mvdEntityRule.Constraints)
                        {
                            DocModelRuleConstraint docRuleConstraint = new DocModelRuleConstraint();
                            docRuleConstraint.Description = mvdConstraint.Expression;
                            docRuleEntity.Rules.Add(docRuleConstraint);
                        }
                    }

                    if(mvdEntityRule.References != null)
                    {
                        // add it later, as referenced templates may not necessarily be loaded yet
                        fixups.Add(mvdEntityRule, docRuleEntity);
                    }
                }
            }

            if (mvdRule.Constraints != null)
            {
                foreach (Constraint mvdConstraint in mvdRule.Constraints)
                {
                    DocModelRuleConstraint docRuleConstraint = new DocModelRuleConstraint();
                    docRuleConstraint.Description = mvdConstraint.Expression;
                    docRule.Rules.Add(docRuleConstraint);
                }
            }

            return docRule;
        }