API: Lucene.Net.Util.MapOfSets: Changed to use ISet<T> instead of HashSet<T> (as was done in Lucene)
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/d683f0fc Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/d683f0fc Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/d683f0fc Branch: refs/heads/master Commit: d683f0fcaff218be71d83259e59e693308193b14 Parents: cf7e749 Author: Shad Storhaug <[email protected]> Authored: Sat Jun 17 13:16:50 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Sat Jun 17 13:16:50 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net/Util/FieldCacheSanityChecker.cs | 16 ++++++++-------- src/Lucene.Net/Util/MapOfSets.cs | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d683f0fc/src/Lucene.Net/Util/FieldCacheSanityChecker.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Util/FieldCacheSanityChecker.cs b/src/Lucene.Net/Util/FieldCacheSanityChecker.cs index ca6d281..c0bd042 100644 --- a/src/Lucene.Net/Util/FieldCacheSanityChecker.cs +++ b/src/Lucene.Net/Util/FieldCacheSanityChecker.cs @@ -118,9 +118,9 @@ namespace Lucene.Net.Util // the indirect mapping lets MapOfSet dedup identical valIds for us // maps the (valId) identityhashCode of cache values to // sets of CacheEntry instances - MapOfSets<int, FieldCache.CacheEntry> valIdToItems = new MapOfSets<int, FieldCache.CacheEntry>(new Dictionary<int, HashSet<FieldCache.CacheEntry>>(17)); + MapOfSets<int, FieldCache.CacheEntry> valIdToItems = new MapOfSets<int, FieldCache.CacheEntry>(new Dictionary<int, ISet<FieldCache.CacheEntry>>(17)); // maps ReaderField keys to Sets of ValueIds - MapOfSets<ReaderField, int> readerFieldToValIds = new MapOfSets<ReaderField, int>(new Dictionary<ReaderField, HashSet<int>>(17)); + MapOfSets<ReaderField, int> readerFieldToValIds = new MapOfSets<ReaderField, int>(new Dictionary<ReaderField, ISet<int>>(17)); // any keys that we know result in more then one valId ISet<ReaderField> valMismatchKeys = new HashSet<ReaderField>(); @@ -178,8 +178,8 @@ namespace Lucene.Net.Util { // we have multiple values for some ReaderFields - IDictionary<ReaderField, HashSet<int>> rfMap = readerFieldToValIds.Map; - IDictionary<int, HashSet<FieldCache.CacheEntry>> valMap = valIdToItems.Map; + IDictionary<ReaderField, ISet<int>> rfMap = readerFieldToValIds.Map; + IDictionary<int, ISet<FieldCache.CacheEntry>> valMap = valIdToItems.Map; foreach (ReaderField rf in valMismatchKeys) { IList<FieldCache.CacheEntry> badEntries = new List<FieldCache.CacheEntry>(valMismatchKeys.Count * 2); @@ -211,11 +211,11 @@ namespace Lucene.Net.Util { List<Insanity> insanity = new List<Insanity>(23); - Dictionary<ReaderField, HashSet<ReaderField>> badChildren = new Dictionary<ReaderField, HashSet<ReaderField>>(17); + Dictionary<ReaderField, ISet<ReaderField>> badChildren = new Dictionary<ReaderField, ISet<ReaderField>>(17); MapOfSets<ReaderField, ReaderField> badKids = new MapOfSets<ReaderField, ReaderField>(badChildren); // wrapper - IDictionary<int, HashSet<FieldCache.CacheEntry>> viToItemSets = valIdToItems.Map; - IDictionary<ReaderField, HashSet<int>> rfToValIdSets = readerFieldToValIds.Map; + IDictionary<int, ISet<FieldCache.CacheEntry>> viToItemSets = valIdToItems.Map; + IDictionary<ReaderField, ISet<int>> rfToValIdSets = readerFieldToValIds.Map; HashSet<ReaderField> seen = new HashSet<ReaderField>(); @@ -253,7 +253,7 @@ namespace Lucene.Net.Util // every mapping in badKids represents an Insanity foreach (ReaderField parent in badChildren.Keys) { - HashSet<ReaderField> kids = badChildren[parent]; + ISet<ReaderField> kids = badChildren[parent]; List<FieldCache.CacheEntry> badEntries = new List<FieldCache.CacheEntry>(kids.Count * 2); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d683f0fc/src/Lucene.Net/Util/MapOfSets.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Util/MapOfSets.cs b/src/Lucene.Net/Util/MapOfSets.cs index df4ce9d..b8e83e4 100644 --- a/src/Lucene.Net/Util/MapOfSets.cs +++ b/src/Lucene.Net/Util/MapOfSets.cs @@ -26,16 +26,16 @@ namespace Lucene.Net.Util /// </summary> public class MapOfSets<TKey, TValue> { - private readonly IDictionary<TKey, HashSet<TValue>> theMap; // LUCENENET TODO: API Change to ISet + private readonly IDictionary<TKey, ISet<TValue>> theMap; /// <param name="m"> The backing store for this object. </param> - public MapOfSets(IDictionary<TKey, HashSet<TValue>> m) // LUCENENET TODO: API Change to ISet + public MapOfSets(IDictionary<TKey, ISet<TValue>> m) { theMap = m; } /// <returns> Direct access to the map backing this object. </returns> - public virtual IDictionary<TKey, HashSet<TValue>> Map // LUCENENET TODO: API Change to ISet + public virtual IDictionary<TKey, ISet<TValue>> Map { get { @@ -50,7 +50,7 @@ namespace Lucene.Net.Util /// <returns> The size of the <see cref="ISet{T}"/> associated with key once val is added to it. </returns> public virtual int Put(TKey key, TValue val) { - HashSet<TValue> theSet; // LUCENENET TODO: API Change to ISet + ISet<TValue> theSet; if (theMap.ContainsKey(key)) { theSet = theMap[key]; @@ -71,7 +71,7 @@ namespace Lucene.Net.Util /// <returns> The size of the <see cref="ISet{T}"/> associated with key once val is added to it. </returns> public virtual int PutAll(TKey key, IEnumerable<TValue> vals) { - HashSet<TValue> theSet; // LUCENENET TODO: API Change to ISet + ISet<TValue> theSet; if (theMap.ContainsKey(key)) { theSet = theMap[key];
