Example #1
0
 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("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("element", string.Format("Unsupported rule element. ElementType={0}", element.GetType()));
     }
 }
 public void Visit(TContext context, RuleElement element)
 {
     element.Accept(context, this);
 }