コード例 #1
0
 /// <summary>
 /// Add set if it is unique among sets added before
 /// </summary>
 /// <param name="set">Set</param>
 /// <returns>True if the set has been added</returns>
 public bool AddUniqueSet(S.ISet <TType> set)
 {
     foreach (S.ISet <TType> savedSet in sets)
     {
         if (savedSet.IsDuplicate(set))
         {
             // increment duplicates counter in the unique set
             savedSet.DuplicatesCount++;
             // the set is duplicate, do not add
             return(false);
         }
     }
     sets.Add(set);
     return(true);
 }
コード例 #2
0
        /// <summary>
        /// Get the most frequent duplicate
        /// </summary>
        /// <returns>The most frequent duplicate</returns>
        public S.ISet <TType> GetMostFrequentSet()
        {
            // init for finding the maximum duplicates count
            int maxDupCount = -1;

            S.ISet <TType> mostFrequent = null;

            foreach (S.ISet <TType> set in sets)
            {
                if (set.DuplicatesCount > maxDupCount)
                {
                    maxDupCount  = set.DuplicatesCount;
                    mostFrequent = set;
                }
            }
            return(mostFrequent);
        }