Example #1
0
        public WindowsFlushResult Flush(bool restartPhase = false)
        {
            var result = new WindowsFlushResult();

            for (var i = 0; i < windows.Count; i++)
            {
                var window = windows[i];

                if (window.ShouldBeClosedBefore(maximumObservedTimestamp) || window.ExistsForTooLong(restartPhase))
                {
                    windows.RemoveAt(i--);

                    if (!restartPhase)
                    {
                        window.Flush();
                    }

                    if (minimumAllowedTimestamp < window.End)
                    {
                        minimumAllowedTimestamp = window.End;
                    }
                }
                else
                {
                    result.AddWindow(window.EventsCount, window.FirstEventCoordinates);
                }
            }

            return(result);
        }
 public void MergeWith(WindowsFlushResult other)
 {
     AddFirstActiveEventCoordinates(other.FirstEventCoordinates);
     EventsCount  += other.EventsCount;
     WindowsCount += other.WindowsCount;
 }