public ICollection<EventBean> Lookup(
            EventBean[] eventPerStream,
            IDictionary<object, CompositeIndexEntry> parent,
            ICollection<EventBean> result,
            CompositeIndexQuery next,
            ExprEvaluatorContext context,
            ICollection<object> optionalKeyCollector,
            CompositeIndexQueryResultPostProcessor postProcessor)
        {
            var index = (IOrderedDictionary<object, CompositeIndexEntry>) parent;
            var comparable = base.EvaluatePerStream(eventPerStream, context);
            optionalKeyCollector?.Add(comparable);

            if (comparable == null) {
                return null;
            }

            return CompositeIndexQueryRange.Handle(
                eventPerStream,
                index.Tail(comparable),
                null,
                result,
                next,
                postProcessor);
        }
Exemple #2
0
        public ICollection<EventBean> Lookup(
            EventBean[] eventsPerStream,
            IDictionary<object, CompositeIndexEntry> parent,
            ICollection<EventBean> result,
            CompositeIndexQuery next,
            ExprEvaluatorContext context,
            ICollection<object> optionalKeyCollector,
            CompositeIndexQueryResultPostProcessor postProcessor)
        {
            var comparableStart = EvaluatePerStreamStart(eventsPerStream, context);
            optionalKeyCollector?.Add(comparableStart);

            if (comparableStart == null) {
                return null;
            }

            var comparableEnd = EvaluatePerStreamEnd(eventsPerStream, context);
            optionalKeyCollector?.Add(comparableEnd);

            if (comparableEnd == null) {
                return null;
            }

            var index = (IOrderedDictionary<object, CompositeIndexEntry>) parent;
            var submapOne = index.Head(comparableStart, !includeStart);
            var submapTwo = index.Tail(comparableEnd, !includeEnd);
            return CompositeIndexQueryRange.Handle(eventsPerStream, submapOne, submapTwo, result, next, postProcessor);
        }
Exemple #3
0
        public ICollection<EventBean> Lookup(
            EventBean theEvent,
            IDictionary<object, CompositeIndexEntry> parent,
            ICollection<EventBean> result,
            CompositeIndexQuery next,
            ExprEvaluatorContext context,
            ICollection<object> optionalKeyCollector,
            CompositeIndexQueryResultPostProcessor postProcessor)
        {
            object comparableStart = base.EvaluateLookupStart(theEvent, context);
            optionalKeyCollector?.Add(comparableStart);

            if (comparableStart == null) {
                return null;
            }

            object comparableEnd = base.EvaluateLookupEnd(theEvent, context);
            optionalKeyCollector?.Add(comparableEnd);

            if (comparableEnd == null) {
                return null;
            }

            IOrderedDictionary<object, CompositeIndexEntry> index =
                (IOrderedDictionary<object, CompositeIndexEntry>) parent;

            
            IDictionary<object, CompositeIndexEntry> submap;
            if (index.KeyComparer.Compare(comparableStart, comparableEnd) <= 0) {
                submap = index.Between(comparableStart, includeStart, comparableEnd, includeEnd);
            }
            else if (_allowReverseRange) {
                submap = index.Between(comparableEnd, includeStart, comparableStart, includeEnd);
            }
            else {
                return null;
            }

            return CompositeIndexQueryRange.Handle(theEvent, submap, null, result, next, postProcessor);
        }