示例#1
0
        public RuleSet DeleteRule(TransformerBase rule)
        {
            for (var i = 0; i < Rules.Count; ++i)
            {
                if (Rules[i] == rule)
                {
                    Rules.Remove(rule);

                    break;
                }
            }

            // reset granularity to max granularity
            Granularity = CalculateGranularity();

            return(this);
        }
示例#2
0
 public RuleSet AddRule(TransformerBase rule)
 {
     if (Granularity == Granularity.Unknown)
     {
         Granularity = rule.Granularity;
     }
     else
     {
         if (rule.Granularity > Granularity)
         {
             Granularity = rule.Granularity;
             // TODO: better exception reporting
             //throw new GranularityViolationException(string.Format("Type {0} cannot be added to RuleSet", rule.ToString()));
         }
     }
     Rules.Add(rule);
     return(this);
 }