Exemple #1
0
        private IAggregator CreateAggregator(Tuple tuple)
        {
            var aggregator = _aggregatorFactory.Create();

            tuple.SetState(this, aggregator);
            return(aggregator);
        }
Exemple #2
0
        public static Quantifier CreateQuantifier(this Tuple tuple, INode node)
        {
            var quantifier = new Quantifier();

            tuple.SetState(node, quantifier);
            return(quantifier);
        }
Exemple #3
0
        private IFactAggregator CreateFactAggregator(Tuple tuple)
        {
            var aggregator     = _aggregatorFactory.Create();
            var factAggregator = new FactAggregator(aggregator);

            tuple.SetState(this, factAggregator);
            return(factAggregator);
        }
Exemple #4
0
        private IAggregator CreateAggregator(IExecutionContext context, Tuple tuple)
        {
            var aggregator = _aggregatorFactory.Create();

            tuple.SetState(this, aggregator);
            var results = aggregator.Initial();

            HandleAggregationResult(context, results, tuple);
            return(aggregator);
        }
Exemple #5
0
        private IAggregate GetAggregate(Tuple tuple)
        {
            var aggregate = tuple.GetState <IAggregate>();

            if (aggregate == null)
            {
                aggregate = _aggregateFactory();
                tuple.SetState(aggregate);
            }
            return(aggregate);
        }
Exemple #6
0
 private void AssertBinding(IExecutionContext context, Tuple tuple, TupleFactList toAssert)
 {
     try
     {
         var value = BindingExpression.Invoke(context, NodeInfo, tuple);
         var fact  = new Fact(value, ResultType);
         tuple.SetState(this, fact);
         toAssert.Add(tuple, fact);
     }
     catch (ExpressionEvaluationException e)
     {
         if (!e.IsHandled)
         {
             throw new RuleLhsExpressionEvaluationException("Failed to evaluate binding expression",
                                                            e.Expression.ToString(), e.InnerException);
         }
     }
 }
Exemple #7
0
 private void AssertBinding(IExecutionContext context, Tuple tuple, TupleFactList toAssert)
 {
     try
     {
         var value = BindingExpression.Invoke(tuple);
         var fact  = new Fact(value, ResultType);
         tuple.SetState(this, fact);
         toAssert.Add(tuple, fact);
     }
     catch (Exception e)
     {
         bool isHandled = false;
         context.EventAggregator.RaiseBindingFailed(context.Session, e, BindingExpression.Expression, tuple, ref isHandled);
         if (!isHandled)
         {
             throw new RuleExpressionEvaluationException("Failed to evaluate binding expression",
                                                         BindingExpression.Expression.ToString(), e);
         }
     }
 }