public int CompareTo(StackHashProductLocaleSummaryCollection other) { if (other == null) { return(-1); } if (other.Count != this.Count) { return(-1); } foreach (StackHashProductLocaleSummary localeSummary in this) { // Find matching locale in other. StackHashProductLocaleSummary matchingLocaleSummary = other.FindLocale(localeSummary.Lcid); if (matchingLocaleSummary == null) { return(-1); } if (localeSummary.CompareTo(matchingLocaleSummary) != 0) { return(-1); } } return(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; } }