You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2020/10/03 23:58:45 UTC

[lucenenet] branch master updated (10b326a -> f5cca0b)

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git.


    from 10b326a  BUG: Lucene.Net.Store.SharingNativeFSLock: Allow other processes (such as RAMDirectory) to read the lock file, only set file sharing to None in IsLocked() to provoke the sharing exception. Fixes #356.
     new fd40e16  BUG: Lucene.Net.Index.IndexFileDeleter: Missing test for Monitor.IsEntered(writer) (as was done in Java)
     new b990b79  Lucene.Net.Analysis.Br.BrazillianStemFilter: removed unused variable "exclusions"
     new 26213e3  Lucene.Net.Analysis.Compound.Hyphenation: Reviewed and removed TODOs
     new f9a348a  PERFORMANCE: Lucene.Net.Util.Automaton.SortedInt32Set: Removed unnecessary IEquatable<T> implementations and converted FrozenInt32Set into a struct.
     new 34b7c57  Lucene.Net.Util.DisposableThreadLocal: Added removal warning to Obsolete attribute instead of in comments
     new 5285722  Lucene.Net.Util.StringHelper: Marked static, removed private ctor, made StartsWith(), EndsWith(), BytesDifference(), and SliceEquals() into extension methods
     new c414dde  Lucene.Net.Util.Bits: Removed unnecessary GetHashCode() method from MatchAllBits and MatchNoBits (didn't exist in Lucene)
     new f5cca0b  Lucene.Net.Util.Counter: Changed Get() to Value property and added implicit operator.

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../Analysis/Br/BrazilianStemFilter.cs             |   8 +-
 .../Compound/Hyphenation/HyphenationTree.cs        |   1 -
 .../Analysis/Compound/Hyphenation/PatternParser.cs |   5 +-
 src/Lucene.Net/Index/DocumentsWriterPerThread.cs   |   2 +-
 src/Lucene.Net/Index/IndexFileDeleter.cs           |   3 +-
 src/Lucene.Net/Search/TimeLimitingCollector.cs     |   6 +-
 src/Lucene.Net/Util/Automaton/SortedIntSet.cs      | 116 +++------------------
 src/Lucene.Net/Util/Bits.cs                        |  11 --
 src/Lucene.Net/Util/CloseableThreadLocal.cs        |   8 +-
 src/Lucene.Net/Util/Counter.cs                     |  22 ++--
 src/Lucene.Net/Util/OfflineSorter.cs               |   2 +-
 src/Lucene.Net/Util/RecyclingByteBlockAllocator.cs |   6 +-
 src/Lucene.Net/Util/RecyclingIntBlockAllocator.cs  |   6 +-
 src/Lucene.Net/Util/StringHelper.cs                |  14 +--
 14 files changed, 57 insertions(+), 153 deletions(-)


[lucenenet] 06/08: Lucene.Net.Util.StringHelper: Marked static, removed private ctor, made StartsWith(), EndsWith(), BytesDifference(), and SliceEquals() into extension methods

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 528572277bd0e3b953ed1f2c789a57a67d744aa4
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Oct 4 03:07:18 2020 +0700

    Lucene.Net.Util.StringHelper: Marked static, removed private ctor, made StartsWith(), EndsWith(), BytesDifference(), and SliceEquals() into extension methods
---
 src/Lucene.Net/Util/StringHelper.cs | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/Lucene.Net/Util/StringHelper.cs b/src/Lucene.Net/Util/StringHelper.cs
index 0e32c3f..eb2e500 100644
--- a/src/Lucene.Net/Util/StringHelper.cs
+++ b/src/Lucene.Net/Util/StringHelper.cs
@@ -28,7 +28,7 @@ namespace Lucene.Net.Util
     /// <para/>
     /// @lucene.internal
     /// </summary>
-    public abstract class StringHelper
+    public static class StringHelper // LUCENENET specific - marked static and removed private constructor
     {
         /// <summary>
         /// Pass this as the seed to <see cref="Murmurhash3_x86_32(byte[], int, int, int)"/>. </summary>
@@ -69,7 +69,7 @@ namespace Lucene.Net.Util
         /// <param name="left"> The first <see cref="BytesRef"/> to compare. </param>
         /// <param name="right"> The second <see cref="BytesRef"/> to compare. </param>
         /// <returns> The number of common elements. </returns>
-        public static int BytesDifference(BytesRef left, BytesRef right)
+        public static int BytesDifference(this BytesRef left, BytesRef right) // LUCENENET specific - converted to extension method
         {
             int len = left.Length < right.Length ? left.Length : right.Length;
             var bytesLeft = left.Bytes;
@@ -86,10 +86,6 @@ namespace Lucene.Net.Util
             return len;
         }
 
-        private StringHelper()
-        {
-        }
-
         /// <summary> Returns a <see cref="T:IComparer{string}"/> over versioned strings such as X.YY.Z
         /// <para/>
         /// @lucene.internal
@@ -154,7 +150,7 @@ namespace Lucene.Net.Util
         ///          The expected prefix </param>
         /// <returns> Returns <c>true</c> if the <paramref name="ref"/> starts with the given <paramref name="prefix"/>.
         ///         Otherwise <c>false</c>. </returns>
-        public static bool StartsWith(BytesRef @ref, BytesRef prefix) // LUCENENET TODO: API - convert to extension method
+        public static bool StartsWith(this BytesRef @ref, BytesRef prefix) // LUCENENET specific - converted to extension method
         {
             return SliceEquals(@ref, prefix, 0);
         }
@@ -169,12 +165,12 @@ namespace Lucene.Net.Util
         ///          The expected suffix </param>
         /// <returns> Returns <c>true</c> if the <paramref name="ref"/> ends with the given <paramref name="suffix"/>.
         ///         Otherwise <c>false</c>. </returns>
-        public static bool EndsWith(BytesRef @ref, BytesRef suffix) // LUCENENET TODO: API - convert to extension method
+        public static bool EndsWith(this BytesRef @ref, BytesRef suffix) // LUCENENET specific - converted to extension method
         {
             return SliceEquals(@ref, suffix, @ref.Length - suffix.Length);
         }
 
-        private static bool SliceEquals(BytesRef sliceToTest, BytesRef other, int pos)
+        private static bool SliceEquals(this BytesRef sliceToTest, BytesRef other, int pos) // LUCENENET specific - converted to extension method
         {
             if (pos < 0 || sliceToTest.Length - pos < other.Length)
             {


[lucenenet] 02/08: Lucene.Net.Analysis.Br.BrazillianStemFilter: removed unused variable "exclusions"

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit b990b79ee11d4c60b2f7596fdcd954356c0d389c
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Oct 4 01:45:56 2020 +0700

    Lucene.Net.Analysis.Br.BrazillianStemFilter: removed unused variable "exclusions"
---
 src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemFilter.cs | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemFilter.cs
index 9c7c1c6..7d6ec70 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemFilter.cs
@@ -1,6 +1,5 @@
 using Lucene.Net.Analysis.TokenAttributes;
 using System;
-using JCG = J2N.Collections.Generic;
 
 namespace Lucene.Net.Analysis.Br
 {
@@ -32,12 +31,11 @@ namespace Lucene.Net.Analysis.Br
     /// <seealso cref="Miscellaneous.SetKeywordMarkerFilter"/>
     public sealed class BrazilianStemFilter : TokenFilter
     {
-
         /// <summary>
         /// <see cref="BrazilianStemmer"/> in use by this filter.
         /// </summary>
-        private BrazilianStemmer stemmer = new BrazilianStemmer();
-        private JCG.HashSet<string> exclusions = null; // LUCENENET TODO: This is odd. No way to set it at all, so it cannot possibly have any values.
+        private readonly BrazilianStemmer stemmer = new BrazilianStemmer();
+        //private JCG.HashSet<string> exclusions = null; // LUCENENET specific: Removed unusd variable
         private readonly ICharTermAttribute termAtt;
         private readonly IKeywordAttribute keywordAttr;
 
@@ -58,7 +56,7 @@ namespace Lucene.Net.Analysis.Br
             {
                 string term = termAtt.ToString();
                 // Check the exclusion table.
-                if (!keywordAttr.IsKeyword && (exclusions == null || !exclusions.Contains(term)))
+                if (!keywordAttr.IsKeyword /*&& (exclusions == null || !exclusions.Contains(term))*/) // LUCENENET specific - removed unused variable "exclusions"
                 {
                     string s = stemmer.Stem(term);
                     // If not stemmed, don't waste the time adjusting the token.


[lucenenet] 08/08: Lucene.Net.Util.Counter: Changed Get() to Value property and added implicit operator.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit f5cca0b1a7c855f2fe44a5cdd27763aab7acdf22
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Oct 4 06:18:43 2020 +0700

    Lucene.Net.Util.Counter: Changed Get() to Value property and added implicit operator.
---
 src/Lucene.Net/Index/DocumentsWriterPerThread.cs   |  2 +-
 src/Lucene.Net/Search/TimeLimitingCollector.cs     |  6 +++---
 src/Lucene.Net/Util/Counter.cs                     | 22 ++++++++++++++++------
 src/Lucene.Net/Util/OfflineSorter.cs               |  2 +-
 src/Lucene.Net/Util/RecyclingByteBlockAllocator.cs |  6 +++---
 src/Lucene.Net/Util/RecyclingIntBlockAllocator.cs  |  6 +++---
 6 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/src/Lucene.Net/Index/DocumentsWriterPerThread.cs b/src/Lucene.Net/Index/DocumentsWriterPerThread.cs
index 3a5ca37..e754738 100644
--- a/src/Lucene.Net/Index/DocumentsWriterPerThread.cs
+++ b/src/Lucene.Net/Index/DocumentsWriterPerThread.cs
@@ -681,7 +681,7 @@ namespace Lucene.Net.Index
         /// Get current segment info we are writing. </summary>
         internal virtual SegmentInfo SegmentInfo => segmentInfo;
 
-        public virtual long BytesUsed => bytesUsed.Get() + pendingUpdates.bytesUsed;
+        public virtual long BytesUsed => bytesUsed + pendingUpdates.bytesUsed;
 
         /// <summary>
         /// Initial chunks size of the shared byte[] blocks used to
diff --git a/src/Lucene.Net/Search/TimeLimitingCollector.cs b/src/Lucene.Net/Search/TimeLimitingCollector.cs
index e4f9d41..121cc89 100644
--- a/src/Lucene.Net/Search/TimeLimitingCollector.cs
+++ b/src/Lucene.Net/Search/TimeLimitingCollector.cs
@@ -147,12 +147,12 @@ namespace Lucene.Net.Search
         }
 
         /// <summary>
-        /// Syntactic sugar for <see cref="SetBaseline(long)"/> using <see cref="Counter.Get()"/>
+        /// Syntactic sugar for <see cref="SetBaseline(long)"/> using <see cref="Counter.Value"/>
         /// on the clock passed to the constructor.
         /// </summary>
         public virtual void SetBaseline()
         {
-            SetBaseline(clock.Get());
+            SetBaseline(clock);
         }
 
         /// <summary>
@@ -176,7 +176,7 @@ namespace Lucene.Net.Search
         ///           If the time allowed has exceeded. </exception>
         public virtual void Collect(int doc)
         {
-            long time = clock.Get();
+            long time = clock;
             if (timeout < time)
             {
                 if (greedy)
diff --git a/src/Lucene.Net/Util/Counter.cs b/src/Lucene.Net/Util/Counter.cs
index f8afcf7..8c72ac6 100644
--- a/src/Lucene.Net/Util/Counter.cs
+++ b/src/Lucene.Net/Util/Counter.cs
@@ -1,4 +1,5 @@
 using J2N.Threading.Atomic;
+using System;
 
 namespace Lucene.Net.Util
 {
@@ -36,10 +37,16 @@ namespace Lucene.Net.Util
         public abstract long AddAndGet(long delta);
 
         /// <summary>
+        /// Gets the counters current value.
+        /// </summary>
+        public abstract long Value { get; }
+
+        /// <summary>
         /// Returns the counters current value.
         /// </summary>
         /// <returns> The counters current value. </returns>
-        public abstract long Get(); // LUCENENET TODO: API: Change to Value property and add implicit operator to get
+        [Obsolete("Use Value instead. This method will be removed in 4.8.0 release candidate.")]
+        public virtual long Get() => Value;
 
         /// <summary>
         /// Returns a new counter. The returned counter is not thread-safe.
@@ -61,6 +68,12 @@ namespace Lucene.Net.Util
             return threadSafe ? (Counter)new AtomicCounter() : new SerialCounter();
         }
 
+        /// <summary>
+        /// Returns this counter's <see cref="Value"/> implicitly.
+        /// </summary>
+        /// <param name="counter"></param>
+        public static implicit operator long(Counter counter) => counter.Value; // LUCENENET specific
+
         private sealed class SerialCounter : Counter
         {
             private long count = 0;
@@ -70,10 +83,7 @@ namespace Lucene.Net.Util
                 return count += delta;
             }
 
-            public override long Get()
-            {
-                return count;
-            }
+            public override long Value => count;
         }
 
         private sealed class AtomicCounter : Counter
@@ -85,7 +95,7 @@ namespace Lucene.Net.Util
                 return count.AddAndGet(delta);
             }
 
-            public override long Get() => count;
+            public override long Value => count;
         }
     }
 }
\ No newline at end of file
diff --git a/src/Lucene.Net/Util/OfflineSorter.cs b/src/Lucene.Net/Util/OfflineSorter.cs
index 0526210..8084522 100644
--- a/src/Lucene.Net/Util/OfflineSorter.cs
+++ b/src/Lucene.Net/Util/OfflineSorter.cs
@@ -465,7 +465,7 @@ namespace Lucene.Net.Util
                 buffer.Append(scratch);
                 // Account for the created objects.
                 // (buffer slots do not account to buffer size.)
-                if (ramBufferSize.bytes < bufferBytesUsed.Get())
+                if (ramBufferSize.bytes < bufferBytesUsed)
                 {
                     break;
                 }
diff --git a/src/Lucene.Net/Util/RecyclingByteBlockAllocator.cs b/src/Lucene.Net/Util/RecyclingByteBlockAllocator.cs
index 737ca9b..df90ff1 100644
--- a/src/Lucene.Net/Util/RecyclingByteBlockAllocator.cs
+++ b/src/Lucene.Net/Util/RecyclingByteBlockAllocator.cs
@@ -109,14 +109,14 @@ namespace Lucene.Net.Util
                 blocks[i] = null;
             }
             bytesUsed.AddAndGet(-(end - stop) * m_blockSize);
-            if (Debugging.AssertsEnabled) Debugging.Assert(bytesUsed.Get() >= 0);
+            if (Debugging.AssertsEnabled) Debugging.Assert(bytesUsed >= 0);
         }
 
         /// <returns> The number of currently buffered blocks. </returns>
         public int NumBufferedBlocks => freeBlocks;
 
         /// <returns> The number of bytes currently allocated by this <see cref="ByteBlockPool.Allocator"/>. </returns>
-        public long BytesUsed => bytesUsed.Get();
+        public long BytesUsed => bytesUsed;
 
         /// <returns> The maximum number of buffered byte blocks. </returns>
         public int MaxBufferedBlocks => maxBufferedBlocks;
@@ -147,7 +147,7 @@ namespace Lucene.Net.Util
                 freeByteBlocks[--freeBlocks] = null;
             }
             bytesUsed.AddAndGet(-count * m_blockSize);
-            if (Debugging.AssertsEnabled) Debugging.Assert(bytesUsed.Get() >= 0);
+            if (Debugging.AssertsEnabled) Debugging.Assert(bytesUsed >= 0);
             return count;
         }
     }
diff --git a/src/Lucene.Net/Util/RecyclingIntBlockAllocator.cs b/src/Lucene.Net/Util/RecyclingIntBlockAllocator.cs
index a8d518e..b741658 100644
--- a/src/Lucene.Net/Util/RecyclingIntBlockAllocator.cs
+++ b/src/Lucene.Net/Util/RecyclingIntBlockAllocator.cs
@@ -120,14 +120,14 @@ namespace Lucene.Net.Util
                 blocks[i] = null;
             }
             bytesUsed.AddAndGet(-(end - stop) * (m_blockSize * RamUsageEstimator.NUM_BYTES_INT32));
-            if (Debugging.AssertsEnabled) Debugging.Assert(bytesUsed.Get() >= 0);
+            if (Debugging.AssertsEnabled) Debugging.Assert(bytesUsed >= 0);
         }
 
         /// <returns> The number of currently buffered blocks. </returns>
         public int NumBufferedBlocks => freeBlocks;
 
         /// <returns> The number of bytes currently allocated by this <see cref="Allocator"/>. </returns>
-        public long BytesUsed => bytesUsed.Get();
+        public long BytesUsed => bytesUsed;
 
         /// <returns> The maximum number of buffered byte blocks. </returns>
         public int MaxBufferedBlocks => maxBufferedBlocks;
@@ -158,7 +158,7 @@ namespace Lucene.Net.Util
                 freeByteBlocks[--freeBlocks] = null;
             }
             bytesUsed.AddAndGet(-count * m_blockSize * RamUsageEstimator.NUM_BYTES_INT32);
-            if (Debugging.AssertsEnabled) Debugging.Assert(bytesUsed.Get() >= 0);
+            if (Debugging.AssertsEnabled) Debugging.Assert(bytesUsed >= 0);
             return count;
         }
     }


[lucenenet] 01/08: BUG: Lucene.Net.Index.IndexFileDeleter: Missing test for Monitor.IsEntered(writer) (as was done in Java)

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit fd40e160ae720baa1daae0090c24ca4dbd462782
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Oct 4 01:42:14 2020 +0700

    BUG: Lucene.Net.Index.IndexFileDeleter: Missing test for Monitor.IsEntered(writer) (as was done in Java)
---
 src/Lucene.Net/Index/IndexFileDeleter.cs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/Lucene.Net/Index/IndexFileDeleter.cs b/src/Lucene.Net/Index/IndexFileDeleter.cs
index 7aeab61..8edfde6 100644
--- a/src/Lucene.Net/Index/IndexFileDeleter.cs
+++ b/src/Lucene.Net/Index/IndexFileDeleter.cs
@@ -118,8 +118,7 @@ namespace Lucene.Net.Index
 
         // called only from assert
         private bool IsLocked =>
-            //LUCENENET TODO: This always returns true - probably incorrect
-            writer == null || true /*Monitor.IsEntered(writer)*/;
+            writer == null || Monitor.IsEntered(writer);
 
         /// <summary>
         /// Initialize the deleter: find all previous commits in


[lucenenet] 07/08: Lucene.Net.Util.Bits: Removed unnecessary GetHashCode() method from MatchAllBits and MatchNoBits (didn't exist in Lucene)

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit c414dde5f9b86bf992decfc3fdce361aa0623e87
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Oct 4 06:05:40 2020 +0700

    Lucene.Net.Util.Bits: Removed unnecessary GetHashCode() method from MatchAllBits and MatchNoBits (didn't exist in Lucene)
---
 src/Lucene.Net/Util/Bits.cs | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/src/Lucene.Net/Util/Bits.cs b/src/Lucene.Net/Util/Bits.cs
index 3558cae..fa46d1d 100644
--- a/src/Lucene.Net/Util/Bits.cs
+++ b/src/Lucene.Net/Util/Bits.cs
@@ -1,5 +1,4 @@
 using Lucene.Net.Support;
-using System;
 
 namespace Lucene.Net.Util
 {
@@ -63,11 +62,6 @@ namespace Lucene.Net.Util
             }
 
             public int Length => _len;
-
-            public override int GetHashCode() // LUCENENET TODO: This wasn't in Lucene - is it needed ?
-            {
-                return ("MatchAllBits" + _len).GetHashCode();
-            }
         }
 
         /// <summary>
@@ -88,11 +82,6 @@ namespace Lucene.Net.Util
             }
 
             public int Length => _len;
-
-            public override int GetHashCode() // LUCENENET TODO: This wasn't in Lucene - is it needed ?
-            {
-                return ("MatchNoBits" + _len).GetHashCode();
-            }
         }
     }
 }
\ No newline at end of file


[lucenenet] 03/08: Lucene.Net.Analysis.Compound.Hyphenation: Reviewed and removed TODOs

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 26213e309a9eba7f5162a7b8fa487127e71889f2
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Oct 4 01:48:06 2020 +0700

    Lucene.Net.Analysis.Compound.Hyphenation: Reviewed and removed TODOs
---
 .../Analysis/Compound/Hyphenation/HyphenationTree.cs                 | 1 -
 .../Analysis/Compound/Hyphenation/PatternParser.cs                   | 5 +----
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/HyphenationTree.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/HyphenationTree.cs
index b271525..6c3ed78 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/HyphenationTree.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/HyphenationTree.cs
@@ -176,7 +176,6 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
         /// <exception cref="IOException"> In case the parsing fails </exception>
         public virtual void LoadPatterns(Stream source, Encoding encoding)
         {
-            // LUCENENET TODO: Create overloads that allow XmlReaderSettings to be passed in.
             var xmlReaderSettings =
                 new XmlReaderSettings
                 {
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
index ffc96ef..fac4261 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
@@ -79,7 +79,6 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
         /// <exception cref="IOException"> In case of an exception while parsing </exception>
         public virtual void Parse(string path)
         {
-            // LUCENENET TODO: Create overloads that allow XmlReaderSettings to be passed in.
             Parse(path, Encoding.UTF8);
         }
 
@@ -92,8 +91,6 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
         public virtual void Parse(string path, Encoding encoding)
         {
             var xmlReaderSettings = GetXmlReaderSettings();
-
-            // LUCENENET TODO: Create overloads that allow XmlReaderSettings to be passed in.
             using (var src = XmlReader.Create(new StreamReader(new FileStream(path, FileMode.Open), encoding), xmlReaderSettings))
             {
                 Parse(src);
@@ -205,7 +202,7 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
                 new XmlReaderSettings
                 {
                     // DTD Processing currently is
-                    // not supported in .NET Standard but will come back in .NET Standard 2.0.
+                    // not supported in .NET Standard 1.x but will come back in .NET Standard 2.0.
                     // https://github.com/dotnet/corefx/issues/4376.
 #if FEATURE_DTD_PROCESSING
                     DtdProcessing = DtdProcessing.Parse,


[lucenenet] 04/08: PERFORMANCE: Lucene.Net.Util.Automaton.SortedInt32Set: Removed unnecessary IEquatable implementations and converted FrozenInt32Set into a struct.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit f9a348a2eaf9ecb322f5b0c6ecd013140c138f7f
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Oct 4 02:56:47 2020 +0700

    PERFORMANCE: Lucene.Net.Util.Automaton.SortedInt32Set: Removed unnecessary IEquatable<T> implementations and converted FrozenInt32Set into a struct.
---
 src/Lucene.Net/Util/Automaton/SortedIntSet.cs | 116 ++++----------------------
 1 file changed, 16 insertions(+), 100 deletions(-)

diff --git a/src/Lucene.Net/Util/Automaton/SortedIntSet.cs b/src/Lucene.Net/Util/Automaton/SortedIntSet.cs
index a3b8360..39ecd15 100644
--- a/src/Lucene.Net/Util/Automaton/SortedIntSet.cs
+++ b/src/Lucene.Net/Util/Automaton/SortedIntSet.cs
@@ -30,7 +30,7 @@ namespace Lucene.Net.Util.Automaton
     /// <para/>
     /// NOTE: This was SortedIntSet in Lucene
     /// </summary>
-    internal sealed class SortedInt32Set : IEquatable<SortedInt32Set>, IEquatable<SortedInt32Set.FrozenInt32Set>
+    internal sealed class SortedInt32Set
     {
         internal int[] values;
         internal int[] counts;
@@ -188,7 +188,7 @@ namespace Lucene.Net.Util.Automaton
             }
         }
 
-        public FrozenInt32Set ToFrozenInt32Set() // LUCENENET TODO: This didn't exist in the original
+        public FrozenInt32Set ToFrozenInt32Set() // LUCENENET specific
         {
             int[] c = new int[upto];
             Array.Copy(values, 0, c, 0, upto);
@@ -207,48 +207,16 @@ namespace Lucene.Net.Util.Automaton
             return hashCode;
         }
 
-        public override bool Equals(object other)
+        public override bool Equals(object obj)
         {
-            if (other == null)
+            if (obj is null)
             {
                 return false;
             }
-            if (!(other is FrozenInt32Set))
+            if (!(obj is SortedInt32Set other)) // LUCENENET specific - don't compare against FrozenInt32Set
             {
                 return false;
             }
-            FrozenInt32Set other2 = (FrozenInt32Set)other;
-            if (hashCode != other2.hashCode)
-            {
-                return false;
-            }
-            if (other2.values.Length != upto)
-            {
-                return false;
-            }
-            for (int i = 0; i < upto; i++)
-            {
-                if (other2.values[i] != values[i])
-                {
-                    return false;
-                }
-            }
-
-            return true;
-        }
-
-        public bool Equals(SortedInt32Set other) // LUCENENET TODO: This didn't exist in the original
-        {
-            throw new NotImplementedException("SortedIntSet Equals");
-        }
-
-        public bool Equals(FrozenInt32Set other) // LUCENENET TODO: This didn't exist in the original
-        {
-            if (other == null)
-            {
-                return false;
-            }
-
             if (hashCode != other.hashCode)
             {
                 return false;
@@ -257,7 +225,6 @@ namespace Lucene.Net.Util.Automaton
             {
                 return false;
             }
-
             for (int i = 0; i < upto; i++)
             {
                 if (other.values[i] != values[i])
@@ -287,11 +254,11 @@ namespace Lucene.Net.Util.Automaton
         /// <summary>
         /// NOTE: This was FrozenIntSet in Lucene
         /// </summary>
-        public sealed class FrozenInt32Set : IEquatable<SortedInt32Set>, IEquatable<FrozenInt32Set> 
+        public struct FrozenInt32Set : IEquatable<FrozenInt32Set>
         {
-            internal readonly int[] values;
-            internal readonly int hashCode;
-            internal readonly State state;
+            internal int[] values;
+            internal int hashCode;
+            internal State state;
 
             public FrozenInt32Set(int[] values, int hashCode, State state)
             {
@@ -312,46 +279,25 @@ namespace Lucene.Net.Util.Automaton
                 return hashCode;
             }
 
-            public override bool Equals(object other)
+            public override bool Equals(object obj)
             {
-                if (other == null)
+                if (obj is null)
                 {
                     return false;
                 }
-                if (other is FrozenInt32Set)
+                if (obj is FrozenInt32Set other)
                 {
-                    FrozenInt32Set other2 = (FrozenInt32Set)other;
-                    if (hashCode != other2.hashCode)
+                    if (hashCode != other.hashCode)
                     {
                         return false;
                     }
-                    if (other2.values.Length != values.Length)
+                    if (other.values.Length != values.Length)
                     {
                         return false;
                     }
                     for (int i = 0; i < values.Length; i++)
                     {
-                        if (other2.values[i] != values[i])
-                        {
-                            return false;
-                        }
-                    }
-                    return true;
-                }
-                else if (other is SortedInt32Set)
-                {
-                    SortedInt32Set other3 = (SortedInt32Set)other;
-                    if (hashCode != other3.hashCode)
-                    {
-                        return false;
-                    }
-                    if (other3.values.Length != values.Length)
-                    {
-                        return false;
-                    }
-                    for (int i = 0; i < values.Length; i++)
-                    {
-                        if (other3.values[i] != values[i])
+                        if (other.values[i] != values[i])
                         {
                             return false;
                         }
@@ -362,38 +308,8 @@ namespace Lucene.Net.Util.Automaton
                 return false;
             }
 
-            public bool Equals(SortedInt32Set other) // LUCENENET TODO: This didn't exist in the original
+            public bool Equals(FrozenInt32Set other) // LUCENENET specific - implemented IEquatable<FrozenInt32Set>
             {
-                if (other == null)
-                {
-                    return false;
-                }
-
-                if (hashCode != other.hashCode)
-                {
-                    return false;
-                }
-                if (other.values.Length != values.Length)
-                {
-                    return false;
-                }
-                for (int i = 0; i < values.Length; i++)
-                {
-                    if (other.values[i] != values[i])
-                    {
-                        return false;
-                    }
-                }
-                return true;
-            }
-
-            public bool Equals(FrozenInt32Set other) // LUCENENET TODO: This didn't exist in the original
-            {
-                if (other == null)
-                {
-                    return false;
-                }
-
                 if (hashCode != other.hashCode)
                 {
                     return false;


[lucenenet] 05/08: Lucene.Net.Util.DisposableThreadLocal: Added removal warning to Obsolete attribute instead of in comments

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 34b7c575d25ca2174d2842b956ce1c0215ee132c
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Oct 4 02:59:24 2020 +0700

    Lucene.Net.Util.DisposableThreadLocal: Added removal warning to Obsolete attribute instead of in comments
---
 src/Lucene.Net/Util/CloseableThreadLocal.cs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Lucene.Net/Util/CloseableThreadLocal.cs b/src/Lucene.Net/Util/CloseableThreadLocal.cs
index b404f23..c394cb7 100644
--- a/src/Lucene.Net/Util/CloseableThreadLocal.cs
+++ b/src/Lucene.Net/Util/CloseableThreadLocal.cs
@@ -110,11 +110,11 @@ namespace Lucene.Net.Util
             }
         }
 
-        [Obsolete("Use Value instead.")]
-        public T Get() => Value; // LUCENENET TODO: API - Remove this before the 4.8.0 release
+        [Obsolete("Use Value instead. This method will be removed in 4.8.0 release candidate.")]
+        public T Get() => Value;
 
-        [Obsolete("Use Value instead.")]
-        public void Set(T value) => Value = value; // LUCENENET TODO: API - Remove this before the 4.8.0 release
+        [Obsolete("Use Value instead. This method will be removed in 4.8.0 release candidate.")]
+        public void Set(T value) => Value = value;
 
         /// <summary>
         /// Gets or sets the value of this instance for the current thread.