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

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

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

            tuple.SetState(this, factAggregator);
            return(factAggregator);
        }
예제 #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);
        }
예제 #5
0
        private IAggregate GetAggregate(Tuple tuple)
        {
            var aggregate = tuple.GetState <IAggregate>();

            if (aggregate == null)
            {
                aggregate = _aggregateFactory();
                tuple.SetState(aggregate);
            }
            return(aggregate);
        }
예제 #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);
         }
     }
 }
예제 #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);
         }
     }
 }