コード例 #1
0
        public override void Update(EventBean[] newData, EventBean[] oldData)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QViewProcessIRStream(this, _lengthWindowViewFactory.ViewName, newData, oldData);
            }

            EventBean[] expiredArr = null;
            if (oldData != null)
            {
                foreach (EventBean anOldData in oldData)
                {
                    _indexedEvents.Remove(anOldData);
                    InternalHandleRemoved(anOldData);
                }

                expiredArr = oldData;
            }

            // add data points to the window
            // we don't care about removed data from a prior view
            if (newData != null)
            {
                foreach (EventBean newEvent in newData)
                {
                    _indexedEvents.Add(newEvent);
                    InternalHandleAdded(newEvent);
                }
            }

            // Check for any events that get pushed out of the window
            int expiredCount = _indexedEvents.Count - _size;

            if (expiredCount > 0)
            {
                expiredArr = _indexedEvents.Take(expiredCount).ToArray();
                foreach (EventBean anExpired in expiredArr)
                {
                    _indexedEvents.Remove(anExpired);
                    InternalHandleExpired(anExpired);
                }
            }

            // If there are child views, call Update method
            if (HasViews)
            {
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().QViewIndicate(this, _lengthWindowViewFactory.ViewName, newData, expiredArr);
                }
                UpdateChildren(newData, expiredArr);
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().AViewIndicate();
                }
            }

            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().AViewProcessIRStream();
            }
        }