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 2022/10/23 05:07:26 UTC

[lucenenet] branch master updated: Removed 2 private nested classes that were not in use (#713)

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


The following commit(s) were added to refs/heads/master by this push:
     new b53d38b99 Removed 2 private nested classes that were not in use (#713)
b53d38b99 is described below

commit b53d38b99eb0379ee2cb2a3d7e5f0c8980a9638c
Author: Ron Clabo <rc...@users.noreply.github.com>
AuthorDate: Sun Oct 23 01:07:22 2022 -0400

    Removed 2 private nested classes that were not in use (#713)
    
    * Removed 3 private nested classes that were not in use: DirectDocValuesProducer.FSTEntry,
    FreeTextSuggester.AnalyzingComparer and Arrays.EmptyArrayHolder. Replaced code with appropriate
    LUCENENET comment.
    
    * Moved EmptyArrayHolder<T> into conditional compilation section
    
    Co-authored-by: Shad Storhaug <sh...@shadstorhaug.com>
---
 .../Memory/DirectDocValuesProducer.cs              |  8 +---
 .../Suggest/Analyzing/FreeTextSuggester.cs         | 46 +---------------------
 src/Lucene.Net/Support/Arrays.cs                   |  2 +
 3 files changed, 4 insertions(+), 52 deletions(-)

diff --git a/src/Lucene.Net.Codecs/Memory/DirectDocValuesProducer.cs b/src/Lucene.Net.Codecs/Memory/DirectDocValuesProducer.cs
index a740abd2e..ba3803f13 100644
--- a/src/Lucene.Net.Codecs/Memory/DirectDocValuesProducer.cs
+++ b/src/Lucene.Net.Codecs/Memory/DirectDocValuesProducer.cs
@@ -654,12 +654,6 @@ namespace Lucene.Net.Codecs.Memory
             internal BinaryEntry values;
         }
 
-        internal class FSTEntry
-        {
-#pragma warning disable 649 // LUCENENET NOTE: Never assigned
-            internal long offset;
-            internal long numOrds;
-#pragma warning restore 649
-        }
+        // LUCENENET specific - removed FSTEntry because it is not in use.
     }
 }
\ No newline at end of file
diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs
index 19e7b3f3f..a0b6f57f1 100644
--- a/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/FreeTextSuggester.cs
@@ -203,51 +203,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
             return fst.GetSizeInBytes();
         }
 
-        private class AnalyzingComparer : IComparer<BytesRef>
-        {
-            private readonly ByteArrayDataInput readerA = new ByteArrayDataInput();
-            private readonly ByteArrayDataInput readerB = new ByteArrayDataInput();
-            private readonly BytesRef scratchA = new BytesRef();
-            private readonly BytesRef scratchB = new BytesRef();
-
-            public virtual int Compare(BytesRef a, BytesRef b)
-            {
-                readerA.Reset(a.Bytes, a.Offset, a.Length);
-                readerB.Reset(b.Bytes, b.Offset, b.Length);
-
-                // By token:
-                scratchA.Length = (ushort)readerA.ReadInt16();
-                scratchA.Bytes = a.Bytes;
-                scratchA.Offset = readerA.Position;
-
-                scratchB.Bytes = b.Bytes;
-                scratchB.Length = (ushort)readerB.ReadInt16();
-                scratchB.Offset = readerB.Position;
-
-                int cmp = scratchA.CompareTo(scratchB);
-                if (cmp != 0)
-                {
-                    return cmp;
-                }
-                readerA.SkipBytes(scratchA.Length);
-                readerB.SkipBytes(scratchB.Length);
-
-                // By length (smaller surface forms sorted first):
-                cmp = a.Length - b.Length;
-                if (cmp != 0)
-                {
-                    return cmp;
-                }
-
-                // By surface form:
-                scratchA.Offset = readerA.Position;
-                scratchA.Length = a.Length - scratchA.Offset;
-                scratchB.Offset = readerB.Position;
-                scratchB.Length = b.Length - scratchB.Offset;
-
-                return scratchA.CompareTo(scratchB);
-            }
-        }
+        // LUCENENET specific - removed AnalyzingComparer because it is not in use.
 
         private Analyzer AddShingles(Analyzer other)
         {
diff --git a/src/Lucene.Net/Support/Arrays.cs b/src/Lucene.Net/Support/Arrays.cs
index 9f8452db3..2cddb06f0 100644
--- a/src/Lucene.Net/Support/Arrays.cs
+++ b/src/Lucene.Net/Support/Arrays.cs
@@ -217,11 +217,13 @@ namespace Lucene.Net.Support
 #endif
         }
 
+#if !FEATURE_ARRAYEMPTY
         private static class EmptyArrayHolder<T>
         {
 #pragma warning disable CA1825 // Avoid zero-length array allocations.
             public static readonly T[] EMPTY = new T[0];
 #pragma warning restore CA1825 // Avoid zero-length array allocations.
         }
+#endif
     }
 }