Esempio n. 1
0
        internal Node(Clause clause, TriggerTree tree, Trigger trigger = null)
        {
            // In order to debug:
            // 1) Enable Count and VerifyTree
            // 2) Run your scenario
            // 3) You will most likely get a break on the error.
            // 4) Enable TraceTree and set it here to get the trace before count
            // Node._count has the global count for breakpoint
            // ShowTrace = _count > 280000;

            Clause = new Clause(clause);  // Drop ignored from node clause
            Tree   = tree;
            if (trigger != null)
            {
                _allTriggers.Add(trigger);
                _triggers.Add(trigger);
            }
        }
Esempio n. 2
0
        internal Node(Clause clause, TriggerTree tree, Trigger trigger = null)
        {
            // In order to debug:
            // 1) Enable Count and VerifyTree
            // 2) Run your scenario
            // 3) You will most likely get a beak on the error.
            // 4) Enable TraceTree and set it hear to get the trace before count
            // Node._count has the global count for breakpointd
            // ShowTrace = _count > 280000;
            Clause = clause;
            Tree   = tree;
            if (trigger != null)
            {
                _allTriggers.Add(trigger);
                _triggers.Add(trigger);
                if (Clause != null)
                {
                    var children = new List <Expression>();
                    foreach (var child in Clause.Children)
                    {
                        var predicate = child;
                        if (predicate.Type == TriggerTree.Ignore)
                        {
                            predicate = child.Children[0];
                        }

                        children.Add(predicate);
                    }

                    if (children.Any())
                    {
                        Expression = Expression.MakeExpression(ExpressionType.And, children.ToArray());
                    }
                }
            }

            if (Expression == null)
            {
                Expression = Expression.ConstantExpression(true);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Trigger"/> class.
 /// Construct a trigger expression.
 /// </summary>
 /// <param name="tree">Trigger tree that contains this trigger.</param>
 /// <param name="expression">Expression for when the trigger action is possible.</param>
 /// <param name="action">Action to take when a trigger matches.</param>
 /// <param name="quantifiers">Quantifiers to dynamically expand the expression.</param>
 internal Trigger(TriggerTree tree, Expression expression, object action, params Quantifier[] quantifiers)
 {
     _tree              = tree;
     Action             = action;
     OriginalExpression = expression;
     _quantifiers       = quantifiers;
     if (expression != null)
     {
         var normalForm = expression.PushDownNot();
         _clauses = GenerateClauses(normalForm).ToList();
         RemoveDuplicatedPredicates();
         OptimizeClauses();
         ExpandQuantifiers();
         RemoveDuplicates();
         MarkSubsumedClauses();
     }
     else
     {
         _clauses = new List <Clause>();
     }
 }
Esempio n. 4
0
 public Debugger(TriggerTree triggers)
 {
     TreeString = triggers.TreeToString();
     Optimizers = triggers.Optimizers;
     Comparers  = triggers.Comparers;
 }