public void NewData(int streamId, EventBean[] newEvents, EventBean[] oldEvents)
        {
            IntersectDefaultViewLocalState localState = _factory.GetDefaultViewLocalStatePerThread();

            if ((oldEvents == null) || (localState.IsDiscardObserverEvents))
            {
                return;
            }

            if (localState.IsRetainObserverEvents)
            {
                localState.OldEventsPerView[streamId] = oldEvents;
                localState.HasRemovestreamData = true;
                return;
            }

            // remove old data from all other views
            localState.IsDiscardObserverEvents = true;
            try
            {
                for (int i = 0; i < mViews.Length; i++)
                {
                    if (i != streamId)
                    {
                        mViews[i].Update(null, oldEvents);
                    }
                }
            }
            finally
            {
                localState.IsDiscardObserverEvents = false;
            }

            UpdateChildren(null, oldEvents);
        }
        public override void Update(EventBean[] newData, EventBean[] oldData)
        {
            if (InstrumentationHelper.ENABLED)
            {
                InstrumentationHelper.Get().QViewProcessIRStream(this, _factory.ViewName, newData, oldData);
            }

            IntersectDefaultViewLocalState localState = _factory.GetDefaultViewLocalStatePerThread();

            if (newData != null)
            {
                // new events must go to all views
                // old events, such as when removing from a named window, get removed from all views
                localState.HasRemovestreamData = false; // changed by observer logic to indicate new data
                localState.IsRetainObserverEvents = true; // enable retain logic in observer
                try
                {
                    foreach (View view in mViews)
                    {
                        view.Update(newData, oldData);
                    }
                }
                finally
                {
                    localState.IsRetainObserverEvents = false;
                }

                // see if any child view has removed any events.
                // if there was an insert stream, handle pushed-out events
                if (localState.HasRemovestreamData)
                {
                    localState.RemovalEvents.Clear();

                    // process each buffer
                    for (int i = 0; i < localState.OldEventsPerView.Length; i++)
                    {
                        if (localState.OldEventsPerView[i] == null)
                        {
                            continue;
                        }

                        EventBean[] viewOldData = localState.OldEventsPerView[i];
                        localState.OldEventsPerView[i] = null; // clear entry

                        // add each event to the set of events removed
                        foreach (EventBean oldEvent in viewOldData)
                        {
                            localState.RemovalEvents.Add(oldEvent);
                        }

                        localState.IsDiscardObserverEvents = true;
                        try
                        {
                            for (int j = 0; j < mViews.Length; j++)
                            {
                                if (i != j)
                                {
                                    mViews[j].Update(null, viewOldData);
                                }
                            }
                        }
                        finally
                        {
                            localState.IsDiscardObserverEvents = false;
                        }
                    }

                    oldData = localState.RemovalEvents.ToArray();
                }

                // indicate new and, possibly, old data
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().QViewIndicate(this, _factory.ViewName, newData, oldData);
                }
                UpdateChildren(newData, oldData);
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().AViewIndicate();
                }
            }

            // handle remove stream
            else if (oldData != null)
            {
                localState.IsDiscardObserverEvents = true; // disable reaction logic in observer
                try
                {
                    foreach (View view in mViews)
                    {
                        view.Update(null, oldData);
                    }
                }
                finally
                {
                    localState.IsDiscardObserverEvents = false;
                }

                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().QViewIndicate(this, _factory.ViewName, null, oldData);
                }
                UpdateChildren(null, oldData);
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().AViewIndicate();
                }
            }

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