DataDictionary.Types.Structure.ApplicableRule C# (CSharp) Méthode

ApplicableRule() public méthode

Indicates that a rule is applicable for this type at the provided priority
public ApplicableRule ( acceptor priority ) : bool
priority DataDictionary.Generated.acceptor
Résultat bool
        public override bool ApplicableRule(acceptor.RulePriority priority)
        {
            if (ApplicableRules == null)
            {
                ApplicableRules = new HashSet<acceptor.RulePriority>();

                // Consider the rules at this level
                foreach (Rule rule in Rules)
                {
                    foreach (acceptor.RulePriority active in rule.ActivationPriorities)
                    {
                        ApplicableRules.Add(active);
                    }
                }

                // Consider the structure elements
                foreach (ITypedElement element in Elements)
                {
                    if (element.Type != null)
                    {
                        foreach (acceptor.RulePriority active in System.Enum.GetValues(typeof(acceptor.RulePriority)))
                        {
                            if (element.Type.ApplicableRule(active))
                            {
                                ApplicableRules.Add(active);
                            }
                        }
                    }
                }
            }

            return ApplicableRules.Contains(priority);
        }