Ejemplo n.º 1
0
 public static void Match(this GroupElement element, Action <AndElement> and, Action <OrElement> or)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element", "Group element cannot be null");
     }
     else if (element is AndElement)
     {
         and.Invoke((AndElement)element);
     }
     else if (element is OrElement)
     {
         or.Invoke((OrElement)element);
     }
     else
     {
         throw new ArgumentOutOfRangeException("element", string.Format("Unsupported group element. ElementType={0}", element.GetType()));
     }
 }
Ejemplo n.º 2
0
        public RuleDefinition(string name, string description, RuleRepeatability repeatability, IEnumerable <string> tags,
                              PriorityElement priority, DependencyGroupElement dependencies, GroupElement leftHandSide, ActionGroupElement rightHandSide)
        {
            _name          = name;
            _description   = description;
            _repeatability = repeatability;
            _tags          = new List <string>(tags);

            _priority      = priority;
            _dependencies  = dependencies;
            _leftHandSide  = leftHandSide;
            _rightHandSide = rightHandSide;
        }