Lucene.Net.Core.Support: Deleted ValueHashSet and ValueList, since they have been consolidated into EquatableSet and EquatableList
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/f25215f5 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/f25215f5 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/f25215f5 Branch: refs/heads/api-work Commit: f25215f5a81ad851304cc35ed1cc73324fbb6e43 Parents: 62160cd Author: Shad Storhaug <[email protected]> Authored: Thu Mar 30 09:25:40 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Thu Mar 30 09:25:40 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.Core/Lucene.Net.csproj | 2 - src/Lucene.Net.Core/Support/ValueHashSet.cs | 71 ------------------------ src/Lucene.Net.Core/Support/ValueList.cs | 68 ----------------------- 3 files changed, 141 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f25215f5/src/Lucene.Net.Core/Lucene.Net.csproj ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Lucene.Net.csproj b/src/Lucene.Net.Core/Lucene.Net.csproj index 57211e0..622d7b3 100644 --- a/src/Lucene.Net.Core/Lucene.Net.csproj +++ b/src/Lucene.Net.Core/Lucene.Net.csproj @@ -710,8 +710,6 @@ <Compile Include="Support\Util\IServiceListable.cs" /> <Compile Include="Support\Util\NamedServiceFactory.cs" /> <Compile Include="Support\Util\ServiceNameAttribute.cs" /> - <Compile Include="Support\ValueHashSet.cs" /> - <Compile Include="Support\ValueList.cs" /> <Compile Include="Support\WeakDictionary.cs" /> <Compile Include="Support\WritableArrayAttribute.cs" /> <Compile Include="Util\Accountable.cs" /> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f25215f5/src/Lucene.Net.Core/Support/ValueHashSet.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Support/ValueHashSet.cs b/src/Lucene.Net.Core/Support/ValueHashSet.cs deleted file mode 100644 index 6227ae7..0000000 --- a/src/Lucene.Net.Core/Support/ValueHashSet.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace Lucene.Net.Support -{ - /// <summary> - /// Java's HashSet is unlike .NET's in that its equals() and hashcode() methods - /// are setup to compare the values of the sets, where in .NET we only check that - /// the references are the same. <see cref="ValueHashSet{T}"/> acts more like the - /// HashSet type in Java by comparing the sets for value equality. - /// </summary> - /// <typeparam name="T"></typeparam> - /// <seealso cref="ValueList{T}"/> - public class ValueHashSet<T> : HashSet<T> - { - public ValueHashSet() - : base() - { } - - public ValueHashSet(IEnumerable<T> collection) - : base(collection) - { } - - public ValueHashSet(IEqualityComparer<T> comparer) - : base(comparer) - { } - -#if FEATURE_SERIALIZABLE - public ValueHashSet(SerializationInfo info, StreamingContext context) - : base(info, context) - { } -#endif - - public ValueHashSet(IEnumerable<T> collection, IEqualityComparer<T> comparer) - : base(collection, comparer) - { } - - - public override bool Equals(object obj) - { - if (obj == this) - { - return true; - } - - if (!(obj is ISet<T>)) - return false; - ICollection<T> c = obj as ICollection<T>; - if (c.Count != Count) - return false; - - // Check to ensure the sets values are the same - return SetEquals(c); - } - - public override int GetHashCode() - { - int h = 0; - var i = GetEnumerator(); - while (i.MoveNext()) - { - T obj = i.Current; - if (!EqualityComparer<T>.Default.Equals(obj, default(T))) - { - h += obj.GetHashCode(); - } - } - return h; - } - } -} http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f25215f5/src/Lucene.Net.Core/Support/ValueList.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Support/ValueList.cs b/src/Lucene.Net.Core/Support/ValueList.cs deleted file mode 100644 index d67ce5c..0000000 --- a/src/Lucene.Net.Core/Support/ValueList.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Lucene.Net.Support -{ - /// <summary> - /// Java's ArrayList is unlike .NET's <see cref="List{T}"/> in that its equals() and hashcode() methods - /// are setup to compare the values of the sets, where in .NET we only check that - /// the references are the same. <see cref="ValueList{T}"/> acts more like the - /// HashSet type in Java by comparing the sets for value equality. - /// </summary> - /// <typeparam name="T"></typeparam> - /// <seealso cref="ValueHashSet{T}"/> - public class ValueList<T> : List<T> - { - public ValueList() - : base() - { } - - public ValueList(int capacity) - : base(capacity) - { } - - public ValueList(IEnumerable<T> collection) - : base(collection) - { } - - public object Clone() - { - return new ValueList<T>(this); - } - - public override bool Equals(object obj) - { - if (obj == this) - { - return true; - } - - if (!(obj is List<T>)) - return false; - ICollection<T> c = obj as ICollection<T>; - if (c.Count != Count) - return false; - - // Check to ensure the sets values are the same - return this.SequenceEqual(c); - } - - public override int GetHashCode() - { - int h = 0; - var i = GetEnumerator(); - while (i.MoveNext()) - { - T obj = i.Current; - if (!EqualityComparer<T>.Default.Equals(obj, default(T))) - { - h += obj.GetHashCode(); - } - } - return h; - } - } -}
