lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [18/50] [abbrv] lucenenet git commit: SWEEP: Replaced all occurrences of ArrayUtil.STRING_ORDINAL_COMPARER with StringComparer.Ordinal and eliminated the ArrayUtil constant and class, since this is exactly the same functionality as in the .NET framework
Date Wed, 15 Mar 2017 23:50:00 GMT
SWEEP: Replaced all occurrences of ArrayUtil.STRING_ORDINAL_COMPARER with StringComparer.Ordinal
and eliminated the ArrayUtil constant and class, since this is exactly the same functionality
as in the .NET framework


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/05bf4af2
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/05bf4af2
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/05bf4af2

Branch: refs/heads/api-work
Commit: 05bf4af2304927bbd7da0b1da68d9a3737e4c5a5
Parents: a51c7f8
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Tue Mar 14 22:11:11 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Tue Mar 14 22:20:47 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/ArrayUtil.cs           | 25 +-------------------
 .../Suggest/Fst/WFSTCompletionTest.cs           |  4 ++--
 src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs       |  8 +++----
 3 files changed, 7 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05bf4af2/src/Lucene.Net.Core/Util/ArrayUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/ArrayUtil.cs b/src/Lucene.Net.Core/Util/ArrayUtil.cs
index 328b31b..d50954a 100644
--- a/src/Lucene.Net.Core/Util/ArrayUtil.cs
+++ b/src/Lucene.Net.Core/Util/ArrayUtil.cs
@@ -806,29 +806,6 @@ namespace Lucene.Net.Util
         }
 
         /// <summary>
-        /// LUCENENET specific - we need custom handling for sorting strings the same
-        /// way they were sorted in Java.
-        /// </summary>
-        private class StringOrdinalComparer : IComparer<string> 
-        {
-            internal StringOrdinalComparer()
-            {
-            }
-
-            public virtual int Compare(string o1, string o2)
-            {
-                return string.CompareOrdinal(o1, o2);
-            }
-        }
-
-        /// <summary>
-        /// A comparer that uses the <see cref="string.CompareOrdinal(string, string)"/>
method to make
-        /// string comparisons, which provides a culture-insensitive sort operation (similar
to Java's default
-        /// string comparision).
-        /// </summary>
-        public static readonly IComparer<string> STRING_ORDINAL_COMPARER = new StringOrdinalComparer();
-
-        /// <summary>
         /// Get the natural <seealso cref="Comparer"/> for the provided object class.
         /// <para/>
         /// The comparer returned depends on the <typeparam name="T"/> argument:
@@ -852,7 +829,7 @@ namespace Lucene.Net.Util
             // in a culture-insenitive manner.
             if (typeof(T).Equals(typeof(string)))
             {
-                return (IComparer<T>)STRING_ORDINAL_COMPARER;
+                return (IComparer<T>)StringComparer.Ordinal;
             }
             // LUCENENET specific - Only return the NaturalComparer if the type
             // implements IComparable<T>, otherwise use Comparer<T>.Default.

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05bf4af2/src/Lucene.Net.Tests.Suggest/Suggest/Fst/WFSTCompletionTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Fst/WFSTCompletionTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Fst/WFSTCompletionTest.cs
index 0e5e0d9..aed96f1 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Fst/WFSTCompletionTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Fst/WFSTCompletionTest.cs
@@ -138,8 +138,8 @@ namespace Lucene.Net.Search.Suggest.Fst
         {
             int numWords = AtLeast(1000);
 
-            IDictionary<string, long> slowCompletor = new SortedDictionary<string,
long>(ArrayUtil.STRING_ORDINAL_COMPARER); //new TreeMap<>();
-            ISet<string> allPrefixes = new SortedSet<string>(ArrayUtil.STRING_ORDINAL_COMPARER);
//new TreeSet<>();
+            IDictionary<string, long> slowCompletor = new SortedDictionary<string,
long>(StringComparer.Ordinal); //new TreeMap<>();
+            ISet<string> allPrefixes = new SortedSet<string>(StringComparer.Ordinal);
//new TreeSet<>();
 
             Input[] keys = new Input[numWords];
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/05bf4af2/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
index 11321fa..76fedad 100644
--- a/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
+++ b/src/Lucene.Net.Tests/Util/Fst/TestFSTs.cs
@@ -1639,8 +1639,8 @@ namespace Lucene.Net.Util.Fst
             Random random = Random();
             int numWords = AtLeast(1000);
 
-            SortedDictionary<string, long> slowCompletor = new SortedDictionary<string,
long>(ArrayUtil.STRING_ORDINAL_COMPARER);
-            SortedSet<string> allPrefixes = new SortedSet<string>(ArrayUtil.STRING_ORDINAL_COMPARER);
+            SortedDictionary<string, long> slowCompletor = new SortedDictionary<string,
long>(StringComparer.Ordinal);
+            SortedSet<string> allPrefixes = new SortedSet<string>(StringComparer.Ordinal);
 
             PositiveInt32Outputs outputs = PositiveInt32Outputs.Singleton;
             Builder<long?> builder = new Builder<long?>(FST.INPUT_TYPE.BYTE1,
outputs);
@@ -1778,8 +1778,8 @@ namespace Lucene.Net.Util.Fst
         {
             int numWords = AtLeast(1000);
 
-            SortedDictionary<string, TwoLongs> slowCompletor = new SortedDictionary<string,
TwoLongs>(ArrayUtil.STRING_ORDINAL_COMPARER);
-            SortedSet<string> allPrefixes = new SortedSet<string>(ArrayUtil.STRING_ORDINAL_COMPARER);
+            SortedDictionary<string, TwoLongs> slowCompletor = new SortedDictionary<string,
TwoLongs>(StringComparer.Ordinal);
+            SortedSet<string> allPrefixes = new SortedSet<string>(StringComparer.Ordinal);
 
             PairOutputs<long?, long?> outputs = new PairOutputs<long?, long?>(PositiveInt32Outputs.Singleton,
PositiveInt32Outputs.Singleton); // output -  weight
             Builder<Pair> builder = new Builder<Pair>(FST.INPUT_TYPE.BYTE1, outputs);


Mime
View raw message