Exemplo n.º 1
0
        public int CompareTo(StackHashProductHitDateSummaryCollection other)
        {
            if (other == null)
            {
                return(-1);
            }
            if (other.Count != this.Count)
            {
                return(-1);
            }

            foreach (StackHashProductHitDateSummary hitDateSummary in this)
            {
                // Find matching in other.
                StackHashProductHitDateSummary matchingSummary = other.FindHitDate(hitDateSummary.HitDate);
                if (matchingSummary == null)
                {
                    return(-1);
                }

                if (hitDateSummary.CompareTo(matchingSummary) != 0)
                {
                    return(-1);
                }
            }

            return(0);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Updates the statistics based on the specified event info.
        /// Each Event info will cause an update to each of the stats lists.
        /// </summary>
        /// <param name="eventInfo">New event info.</param>
        public void AddNewEventInfo(StackHashEventInfo eventInfo)
        {
            if (eventInfo == null)
            {
                throw new ArgumentNullException("eventInfo");
            }

            // ******************************************************
            // Update the locale rollup stats.
            // ******************************************************
            StackHashProductLocaleSummary localeSummary = m_LocaleSummaryCollection.FindLocale((int)eventInfo.Lcid);

            if (localeSummary == null)
            {
                // Not found so add a new entry.
                localeSummary = new StackHashProductLocaleSummary(eventInfo.Language, eventInfo.Lcid, eventInfo.Locale, eventInfo.TotalHits);
                m_LocaleSummaryCollection.Add(localeSummary);
            }
            else
            {
                // Add the total hits to the existing entry.
                localeSummary.TotalHits += eventInfo.TotalHits;
            }

            // ******************************************************
            // Update the OS stats.
            // ******************************************************
            StackHashProductOperatingSystemSummary operatingSystemSummary =
                m_OperatingSystemSummaryCollection.FindOperatingSystem(eventInfo.OperatingSystemName, eventInfo.OperatingSystemVersion);

            if (operatingSystemSummary == null)
            {
                // Not found so add a new entry.
                operatingSystemSummary = new StackHashProductOperatingSystemSummary(eventInfo.OperatingSystemName, eventInfo.OperatingSystemVersion, eventInfo.TotalHits);
                m_OperatingSystemSummaryCollection.Add(operatingSystemSummary);
            }
            else
            {
                // Add the total hits to the existing entry.
                operatingSystemSummary.TotalHits += eventInfo.TotalHits;
            }

            // ******************************************************
            // Update the HitDate stats.
            // ******************************************************
            StackHashProductHitDateSummary hitDateSummary = m_HitDateSummaryCollection.FindHitDate(eventInfo.HitDateLocal);

            if (hitDateSummary == null)
            {
                // Not found so add a new entry.
                hitDateSummary = new StackHashProductHitDateSummary(eventInfo.HitDateLocal, eventInfo.TotalHits);
                m_HitDateSummaryCollection.Add(hitDateSummary);
            }
            else
            {
                // Add the total hits to the existing entry.
                hitDateSummary.TotalHits += eventInfo.TotalHits;
            }
        }