Ejemplo n.º 1
0
        public ICollection <object> EvaluateGetROCollectionScalar(EvaluateParams evaluateParams)
        {
            // rewrite streams
            EventBean[] events = GetEventsPerStreamRewritten(evaluateParams.EventsPerStream);

            ICollection <object> result;

            if (_isCache)
            {
                var cache = evaluateParams.ExprEvaluatorContext.ExpressionResultCacheService.AllocateDeclaredExprLastColl;
                var entry = cache.GetDeclaredExpressionLastColl(_prototype, events);
                if (entry != null)
                {
                    return(entry.Result.Unwrap <object>());
                }

                result = _innerEvaluatorLambda.EvaluateGetROCollectionScalar(evaluateParams);
                cache.SaveDeclaredExpressionLastColl(_prototype, events, result.UnwrapSafe <EventBean>());
                return(result);
            }
            else
            {
                result = _innerEvaluatorLambda.EvaluateGetROCollectionScalar(evaluateParams);
            }

            return(result);
        }
Ejemplo n.º 2
0
        public Object EvaluateEnumMethod(EventBean[] eventsLambda, ICollection <object> target, bool isNewData, ExprEvaluatorContext context)
        {
            if (target == null)
            {
                return(null);
            }

            ICollection <object> set;

            if (_scalar)
            {
                set = _evaluator.EvaluateGetROCollectionScalar(eventsLambda, isNewData, context);
            }
            else
            {
                set = _evaluator.EvaluateGetROCollectionEvents(eventsLambda, isNewData, context).TransformInto(
                    o => (EventBean)o,
                    e => (Object)e);
            }

            if (set == null || set.IsEmpty())
            {
                return(target);
            }

            var result = new List <Object>(target);

            result.AddAll(set);

            return(result);
        }
Ejemplo n.º 3
0
        public Object EvaluateEnumMethod(EventBean[] eventsLambda, ICollection <object> target, bool isNewData, ExprEvaluatorContext context)
        {
            if (target == null)
            {
                return(null);
            }

            ICollection <object> set;

            if (_scalar)
            {
                set = _evaluator.EvaluateGetROCollectionScalar(new EvaluateParams(eventsLambda, isNewData, context));
            }
            else
            {
                set = _evaluator
                      .EvaluateGetROCollectionEvents(new EvaluateParams(eventsLambda, isNewData, context))
                      .TransformInto(o => (EventBean)o, e => (Object)e);
            }

            if (set == null || set.IsEmpty() || target.IsEmpty())
            {
                return(target);
            }

            if (_scalar)
            {
                var resultX = new List <Object>(target);
                resultX.RemoveAll(set);
                return(resultX);
            }

            var targetEvents = target.OfType <EventBean>();
            var sourceEvents = set.OfType <EventBean>();
            var result       = new List <EventBean>();

            // we compare event underlying
            foreach (EventBean targetEvent in targetEvents)
            {
                if (targetEvent == null)
                {
                    result.Add(null);
                    continue;
                }

                bool found = false;
                foreach (EventBean sourceEvent in sourceEvents)
                {
                    if (targetEvent == sourceEvent)
                    {
                        found = true;
                        break;
                    }
                    if (sourceEvent == null)
                    {
                        continue;
                    }
                    if (targetEvent.Underlying.Equals(sourceEvent.Underlying))
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    result.Add(targetEvent);
                }
            }
            return(result);
        }
 public ICollection <object> EvaluateGetROCollectionScalar(EvaluateParams evaluateParams)
 {
     return(_rootLambdaEvaluator.EvaluateGetROCollectionScalar(evaluateParams));
 }
Ejemplo n.º 5
0
 public ICollection <object> EvaluateGetROCollectionScalar(EventBean[] eventsPerStream, bool isNewData, ExprEvaluatorContext context)
 {
     return(_rootLambdaEvaluator.EvaluateGetROCollectionScalar(eventsPerStream, isNewData, context));
 }
 public object Evaluate(EventBean[] eventsPerStream, bool isNewData, ExprEvaluatorContext exprEvaluatorContext)
 {
     return(rootLambdaEvaluator.EvaluateGetROCollectionScalar(eventsPerStream, isNewData, exprEvaluatorContext));
 }