コード例 #1
0
ファイル: RuleDefinition.cs プロジェクト: starnovsky/NRules
        public RuleDefinition(string name, string description, IEnumerable <string> tags, int priority,
                              GroupElement leftHandSide, ActionGroupElement rightHandSide)
        {
            Name        = name;
            Description = description;
            Priority    = priority;

            LeftHandSide  = leftHandSide;
            RightHandSide = rightHandSide;

            if (tags != null)
            {
                _tags.AddRange(tags);
            }
        }
コード例 #2
0
        public RuleDefinition(string name, string description, int priority,
                              RuleRepeatability repeatability, IEnumerable <string> tags, IEnumerable <RuleProperty> properties,
                              DependencyGroupElement dependencies, GroupElement leftHandSide, ActionGroupElement rightHandSide)
        {
            _name          = name;
            _description   = description;
            _repeatability = repeatability;
            _priority      = priority;
            _tags          = new List <string>(tags);
            _properties    = new PropertyMap(properties);

            _dependencies  = dependencies;
            _leftHandSide  = leftHandSide;
            _rightHandSide = rightHandSide;
        }
コード例 #3
0
        public RuleDefinition(string name, string description, int priority,
                              RuleRepeatability repeatability, IEnumerable <string> tags, IEnumerable <RuleProperty> properties,
                              DependencyGroupElement dependencies, FilterGroupElement filters, GroupElement leftHandSide, ActionGroupElement rightHandSide)
        {
            Name          = name;
            Description   = description;
            Repeatability = repeatability;
            Priority      = priority;
            _tags         = new List <string>(tags);
            Properties    = new PropertyMap(properties);

            DependencyGroup = dependencies;
            FilterGroup     = filters;
            LeftHandSide    = leftHandSide;
            RightHandSide   = rightHandSide;
        }
コード例 #4
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()));
     }
 }