public CompiledRule(IRuleDefinition definition, IEnumerable <IRuleAction> actions)
 {
     _priority      = definition.Priority;
     _repeatability = definition.Repeatability;
     _definition    = definition;
     _actions       = new List <IRuleAction>(actions);
 }
Exemple #2
0
 public CompiledRule(IRuleDefinition definition, IEnumerable<IRuleAction> actions, IEnumerable<IRuleDependency> dependencies)
 {
     _priority = definition.Priority;
     _repeatability = definition.Repeatability;
     _definition = definition;
     _actions = new List<IRuleAction>(actions);
     _dependencies = new List<IRuleDependency>(dependencies);
 }
Exemple #3
0
 public CompiledRule(IRuleDefinition definition, IEnumerable <Declaration> declarations, IEnumerable <IRuleAction> actions, IEnumerable <IRuleDependency> dependencies)
 {
     _priority      = definition.Priority;
     _repeatability = definition.Repeatability;
     _definition    = definition;
     _declarations  = new List <Declaration>(declarations);
     _actions       = new List <IRuleAction>(actions);
     _dependencies  = new List <IRuleDependency>(dependencies);
 }
        public RuleDefinition(string name, string description, int priority, RuleRepeatability repeatability, IEnumerable <string> tags,
                              GroupElement leftHandSide, ActionGroupElement rightHandSide)
        {
            _name          = name;
            _description   = description;
            _repeatability = repeatability;
            _priority      = priority;
            _tags          = new List <string>(tags);

            _leftHandSide  = leftHandSide;
            _rightHandSide = rightHandSide;
        }
        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;
        }
Exemple #6
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;
        }
Exemple #7
0
        /// <summary>
        /// Creates a rule definition.
        /// </summary>
        /// <param name="name">Rule's name.</param>
        /// <param name="description">Rule's description.</param>
        /// <param name="priority">Rule's priority.</param>
        /// <param name="repeatability">Rule's repeatability.</param>
        /// <param name="tags">Tags associated with the rule.</param>
        /// <param name="properties">Properties associated with the rule.</param>
        /// <param name="dependencies">Rule's dependency group element.</param>
        /// <param name="leftHandSide">Rule's left-hand side top group element.</param>
        /// <param name="filters">Rule's filter group element.</param>
        /// <param name="rightHandSide">Rule's right-hand side group element.</param>
        /// <returns>Created rule definition.</returns>
        public static IRuleDefinition RuleDefinition(string name, string description, int priority,
                                                     RuleRepeatability repeatability, IEnumerable <string> tags, IEnumerable <RuleProperty> properties,
                                                     DependencyGroupElement dependencies, GroupElement leftHandSide, FilterGroupElement filters, ActionGroupElement rightHandSide)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Rule name not provided", nameof(name));
            }
            if (tags == null)
            {
                throw new ArgumentNullException(nameof(tags), "Rule tags not provided");
            }
            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties), "Rule properties not provided");
            }
            if (dependencies == null)
            {
                throw new ArgumentNullException(nameof(dependencies), "Rule dependencies not provided");
            }
            if (leftHandSide == null)
            {
                throw new ArgumentNullException(nameof(leftHandSide), "Rule left-hand side not provided");
            }
            if (filters == null)
            {
                throw new ArgumentNullException(nameof(filters), "Rule filters not provided");
            }
            if (rightHandSide == null)
            {
                throw new ArgumentNullException(nameof(rightHandSide), "Rule right-hand side not provided");
            }

            var ruleDefinition = new RuleDefinition(name, description, priority, repeatability, tags, properties, dependencies, leftHandSide, filters, rightHandSide);

            ElementValidator.ValidateUniqueDeclarations(ruleDefinition.LeftHandSide, ruleDefinition.DependencyGroup);
            ElementValidator.ValidateRuleDefinition(ruleDefinition);

            return(ruleDefinition);
        }
 public RepeatabilityAttribute(RuleRepeatability value)
 {
     Value = value;
 }
Exemple #9
0
 /// <summary>
 /// Sets rule's repeatability.
 /// Default repeatability is <see cref="RuleRepeatability.Repeatable"/>.
 /// </summary>
 public void Repeatability(RuleRepeatability repeatability)
 {
     _repeatability = repeatability;
 }
 public RepeatabilityAttribute(RuleRepeatability value)
 {
     Value = value;
 }
Exemple #11
0
 /// <summary>
 /// Sets rule's repeatability.
 /// Default repeatability is <see cref="RuleRepeatability.Repeatable"/>.
 /// </summary>
 public void Repeatability(RuleRepeatability repeatability)
 {
     _repeatability = repeatability;
 }