Ejemplo n.º 1
0
        private static IEnumerator <EventBean> DistinctEnumeration(IEnumerator <EventBean> source, EventType eventType)
        {
            EventBeanReader eventBeanReader = null;

            if (eventType is EventTypeSPI)
            {
                eventBeanReader = ((EventTypeSPI)eventType).GetReader();
            }
            if (eventBeanReader == null)
            {
                eventBeanReader = new EventBeanReaderDefaultImpl(eventType);
            }

            if (source != null)
            {
                var events = new LinkedList <EventBean>();
                while (source.MoveNext())
                {
                    events.AddLast(source.Current);
                }

                if (events.Count <= 1)
                {
                    return(events.GetEnumerator());
                }

                IList <EventBean> result = EventBeanUtility.GetDistinctByProp(events, eventBeanReader);
                return(result.GetEnumerator());
            }

            return(EnumerationHelper <EventBean> .CreateEmptyEnumerator());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns an enumerator that iterates through the collection.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.Collections.Generic.IEnumerator`1"></see> that can be used to iterate through the collection.
        /// </returns>
        public IEnumerator <EventBean> GetEnumerator()
        {
            // Return null if not started
            StatementContext.VariableService.SetLocalVersion();
            if (_parentView == null)
            {
                return(EnumerationHelper <EventBean> .CreateEmptyEnumerator());
            }

            IEnumerator <EventBean> theEnumerator;

            if (StatementContext.ContextDescriptor != null)
            {
                theEnumerator = StatementContext.ContextDescriptor.GetEnumerator(StatementContext.StatementId);
            }
            else
            {
                theEnumerator = _parentView.GetEnumerator();
            }

            if (StatementContext.EpStatementHandle.HasTableAccess)
            {
                return(GetUnsafeEnumeratorWTableImpl(
                           theEnumerator, StatementContext.TableExprEvaluatorContext));
            }

            return(theEnumerator);
        }
Ejemplo n.º 3
0
 public IEnumerator <EventBean> GetEnumerator(ISet <MultiKey <EventBean> > joinSet)
 {
     EventBean[] result;
     if (_prototype.OptionalHavingNode == null)
     {
         if (_orderByProcessor == null)
         {
             result = ResultSetProcessorUtil.GetSelectJoinEventsNoHaving(_selectExprProcessor, joinSet, true, true, _exprEvaluatorContext);
         }
         else
         {
             result = ResultSetProcessorUtil.GetSelectJoinEventsNoHavingWithOrderBy(_selectExprProcessor, _orderByProcessor, joinSet, true, true, _exprEvaluatorContext);
         }
     }
     else
     {
         if (_orderByProcessor == null)
         {
             result = ResultSetProcessorUtil.GetSelectJoinEventsHaving(_selectExprProcessor, joinSet, _prototype.OptionalHavingNode, true, true, _exprEvaluatorContext);
         }
         else
         {
             result = ResultSetProcessorUtil.GetSelectJoinEventsHavingWithOrderBy(_selectExprProcessor, _orderByProcessor, joinSet, _prototype.OptionalHavingNode, true, true, _exprEvaluatorContext);
         }
     }
     if (result == null)
     {
         return(EnumerationHelper <EventBean> .CreateEmptyEnumerator());
     }
     return(((IEnumerable <EventBean>)result).GetEnumerator());
 }
Ejemplo n.º 4
0
 public override IEnumerator <EventBean> GetEnumerator()
 {
     if (_lastResult == null)
     {
         return(EnumerationHelper <EventBean> .CreateEmptyEnumerator());
     }
     return(((IEnumerable <EventBean>)_lastResult).GetEnumerator());
 }
Ejemplo n.º 5
0
        private IEnumerator <EventBean> ObtainEnumerator()
        {
            var selectNewEvents = GetSelectListEvents(true, true, false);

            return(selectNewEvents != null
                ? EnumerationHelper <EventBean> .CreateSingletonEnumerator(selectNewEvents[0])
                : EnumerationHelper <EventBean> .CreateEmptyEnumerator());
        }
        public override IEnumerator <EventBean> GetEnumerator(Viewable parent)
        {
            var output = GenerateOutputEventsView(_unboundHelper.Buffer, true, true);

            if (output == null)
            {
                return(EnumerationHelper <EventBean> .CreateEmptyEnumerator());
            }
            return(((IEnumerable <EventBean>)output).GetEnumerator());
        }
        public IEnumerator <EventBean> ObtainEnumerator()
        {
            EventBean[] selectNewEvents = GetSelectListEvents(true, true, false);
            if (selectNewEvents != null)
            {
                return(EnumerationHelper <EventBean> .CreateSingletonEnumerator(selectNewEvents[0]));
            }

            return(EnumerationHelper <EventBean> .CreateEmptyEnumerator());
        }
        public override IEnumerator <EventBean> GetEnumerator(ISet <MultiKey <EventBean> > joinSet)
        {
            // Process join results set as a regular join, includes sorting and having-clause filter
            UniformPair <EventBean[]> result = ProcessJoinResult(joinSet, CollectionUtil.EMPTY_ROW_SET, true);

            if ((result == null) || (result.First == null))
            {
                return(EnumerationHelper <EventBean> .CreateEmptyEnumerator());
            }
            return(((IEnumerable <EventBean>)result.First).GetEnumerator());
        }
Ejemplo n.º 9
0
        public override IEnumerator <EventBean> GetEnumerator(Viewable parent)
        {
            if (_orderByProcessor != null)
            {
                // Pull all events, generate order keys
                var eventsPerStream = new EventBean[1];
                var events          = new List <EventBean>();
                var orderKeys       = new List <Object>();

                var parentEnumerator = parent.GetEnumerator();
                if (parentEnumerator.MoveNext() == false)
                {
                    return(CollectionUtil.NULL_EVENT_ITERATOR);
                }

                do
                {
                    var aParent = parentEnumerator.Current;
                    eventsPerStream[0] = aParent;
                    var orderKey = _orderByProcessor.GetSortKey(eventsPerStream, true, ExprEvaluatorContext);
                    var pair     = ProcessViewResultIterator(eventsPerStream);
                    var result   = pair.First;
                    if (result != null && result.Length != 0)
                    {
                        events.Add(result[0]);
                    }
                    orderKeys.Add(orderKey);
                } while (parentEnumerator.MoveNext());

                // sort
                var outgoingEvents = events.ToArray();
                var orderKeysArr   = orderKeys.ToArray();
                var orderedEvents  = _orderByProcessor.Sort(outgoingEvents, orderKeysArr, ExprEvaluatorContext);
                if (orderedEvents == null)
                {
                    return(EnumerationHelper <EventBean> .CreateEmptyEnumerator());
                }

                return(((IEnumerable <EventBean>)orderedEvents).GetEnumerator());
            }
            // Return an iterator that gives row-by-row a result

            var transform = new ResultSetProcessorSimpleTransform(this);

            return(parent.Select(transform.Transform).GetEnumerator());
        }
Ejemplo n.º 10
0
        public IEnumerator <EventBean> GetEnumerator()
        {
            return(EnumerationHelper <EventBean> .CreateEmptyEnumerator());

            //return ((IEnumerable<EventBean>) null).GetEnumerator();
        }
Ejemplo n.º 11
0
 public override IEnumerator <EventBean> GetEnumerator()
 {
     return(EnumerationHelper <EventBean> .CreateEmptyEnumerator());
 }