Beispiel #1
0
 protected void AddExports(RuleElement element)
 {
     if (element != null)
     {
         AddExports(new[] { element });
     }
 }
Beispiel #2
0
 internal void AddImports(RuleElement element)
 {
     if (element != null)
     {
         AddImports(new[] { element });
     }
 }
Beispiel #3
0
        internal PatternElement(Declaration declaration, ExpressionCollection expressions, RuleElement source)
        {
            Declaration = declaration;
            ValueType   = declaration.Type;
            Expressions = expressions;
            Source      = source;

            AddExport(declaration);
            AddImports(expressions);
            AddImports(source);
        }
 public static void Match(this RuleElement element,
                          Action <PatternElement> pattern,
                          Action <AggregateElement> aggregate,
                          Action <GroupElement> group,
                          Action <ExistsElement> exists,
                          Action <NotElement> not,
                          Action <ForAllElement> forall)
 {
     if (element == null)
     {
         throw new ArgumentNullException(nameof(element), "Rule element cannot be null");
     }
     else if (element is PatternElement)
     {
         pattern.Invoke((PatternElement)element);
     }
     else if (element is GroupElement)
     {
         group.Invoke((GroupElement)element);
     }
     else if (element is AggregateElement)
     {
         aggregate.Invoke((AggregateElement)element);
     }
     else if (element is ExistsElement)
     {
         exists.Invoke((ExistsElement)element);
     }
     else if (element is NotElement)
     {
         not.Invoke((NotElement)element);
     }
     else if (element is ForAllElement)
     {
         forall.Invoke((ForAllElement)element);
     }
     else
     {
         throw new ArgumentOutOfRangeException(nameof(element),
                                               $"Unsupported rule element. ElementType={element.GetType()}");
     }
 }
 public static void Match(this RuleElement element, Action <PatternElement> pattern, Action <AggregateElement> aggregate, Action <GroupElement> group)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element", "Rule element cannot be null");
     }
     else if (element is PatternElement)
     {
         pattern.Invoke((PatternElement)element);
     }
     else if (element is GroupElement)
     {
         group.Invoke((GroupElement)element);
     }
     else if (element is AggregateElement)
     {
         aggregate.Invoke((AggregateElement)element);
     }
     else
     {
         throw new ArgumentOutOfRangeException("element", string.Format("Unsupported rule element. ElementType={0}", element.GetType()));
     }
 }