lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [04/27] lucenenet git commit: Lucene.Net.Core.Search.FieldCache.Bytes: Changed return type of Get() from sbyte to byte for CLS compliance. Also changed IByteParser to byte.
Date Thu, 02 Mar 2017 01:10:47 GMT
Lucene.Net.Core.Search.FieldCache.Bytes: Changed return type of Get() from sbyte to byte for
CLS compliance. Also changed IByteParser to byte.


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

Branch: refs/heads/api-work
Commit: 91c75cd9d97acb1ecbfb81da9726cf76cea2ba75
Parents: 8385761
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Wed Mar 1 22:07:17 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Thu Mar 2 08:08:36 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Search/FieldCache.cs              | 10 +++++-----
 src/Lucene.Net.Core/Search/FieldCacheImpl.cs          | 10 +++++-----
 src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs   |  2 +-
 src/Lucene.Net.Core/Search/FieldComparator.cs         |  6 +++---
 .../Function/ValueSources/ByteFieldSource.cs          | 14 +++++++-------
 .../Index/TestDocValuesWithThreads.cs                 |  2 +-
 src/Lucene.Net.Tests/Search/TestFieldCache.cs         |  2 +-
 src/Lucene.Net.Tests/Search/TestSort.cs               |  4 ++--
 8 files changed, 25 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/91c75cd9/src/Lucene.Net.Core/Search/FieldCache.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FieldCache.cs b/src/Lucene.Net.Core/Search/FieldCache.cs
index bb34675..ebc5939 100644
--- a/src/Lucene.Net.Core/Search/FieldCache.cs
+++ b/src/Lucene.Net.Core/Search/FieldCache.cs
@@ -370,13 +370,13 @@ namespace Lucene.Net.Search
     {
         public abstract class Bytes
         {
-            public abstract sbyte Get(int docID); // LUCENENET TODO: can this be byte?
+            public abstract byte Get(int docID);
 
             public static readonly Bytes EMPTY = new EmptyBytes();
 
             public sealed class EmptyBytes : Bytes
             {
-                public override sbyte Get(int docID) // LUCENENET TODO: can this be byte?
+                public override byte Get(int docID)
                 {
                     return 0;
                 }
@@ -494,7 +494,7 @@ namespace Lucene.Net.Search
 
         public interface IByteParser : IParser
         {
-            sbyte ParseByte(BytesRef term); // LUCENENET TODO: can this be byte?
+            byte ParseByte(BytesRef term);
         }
 
         /// <summary>
@@ -552,13 +552,13 @@ namespace Lucene.Net.Search
 
         private sealed class AnonymousByteParser : IByteParser
         {
-            public sbyte ParseByte(BytesRef term)
+            public byte ParseByte(BytesRef term)
             {
                 // TODO: would be far better to directly parse from
                 // UTF8 bytes... but really users should use
                 // IntField, instead, which already decodes
                 // directly from byte[]
-                return sbyte.Parse(term.Utf8ToString(), CultureInfo.InvariantCulture);
+                return (byte)sbyte.Parse(term.Utf8ToString(), CultureInfo.InvariantCulture);
             }
 
             public override string ToString()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/91c75cd9/src/Lucene.Net.Core/Search/FieldCacheImpl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FieldCacheImpl.cs b/src/Lucene.Net.Core/Search/FieldCacheImpl.cs
index d2857c0..1ecaa99 100644
--- a/src/Lucene.Net.Core/Search/FieldCacheImpl.cs
+++ b/src/Lucene.Net.Core/Search/FieldCacheImpl.cs
@@ -519,9 +519,9 @@ namespace Lucene.Net.Search
                 this.valuesIn = valuesIn;
             }
 
-            public override sbyte Get(int docID)
+            public override byte Get(int docID)
             {
-                return (sbyte)valuesIn.Get(docID);
+                return (byte)valuesIn.Get(docID);
             }
         }
 
@@ -534,9 +534,9 @@ namespace Lucene.Net.Search
                 this.values = values;
             }
 
-            public override sbyte Get(int docID)
+            public override byte Get(int docID)
             {
-                return values[docID];
+                return (byte)values[docID];
             }
         }
 
@@ -589,7 +589,7 @@ namespace Lucene.Net.Search
 
                 protected override void VisitTerm(BytesRef term)
                 {
-                    currentValue = parser.ParseByte(term);
+                    currentValue = (sbyte)parser.ParseByte(term);
                 }
 
                 protected override void VisitDoc(int docID)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/91c75cd9/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs b/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs
index f7202ae..e7e2f24 100644
--- a/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs
+++ b/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs
@@ -261,7 +261,7 @@ namespace Lucene.Net.Search
 
                 protected internal override bool MatchDoc(int doc)
                 {
-                    sbyte value = values.Get(doc);
+                    sbyte value = (sbyte)values.Get(doc);
                     return value >= inclusiveLowerPoint && value <= inclusiveUpperPoint;
                 }
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/91c75cd9/src/Lucene.Net.Core/Search/FieldComparator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FieldComparator.cs b/src/Lucene.Net.Core/Search/FieldComparator.cs
index e4600ef..4c255aa 100644
--- a/src/Lucene.Net.Core/Search/FieldComparator.cs
+++ b/src/Lucene.Net.Core/Search/FieldComparator.cs
@@ -380,7 +380,7 @@ namespace Lucene.Net.Search
 
             public override int CompareBottom(int doc)
             {
-                sbyte v2 = currentReaderValues.Get(doc);
+                sbyte v2 = (sbyte)currentReaderValues.Get(doc);
                 // Test for v2 == 0 to save Bits.get method call for
                 // the common case (doc has value and value is non-zero):
                 if (m_docsWithField != null && v2 == 0 && !m_docsWithField.Get(doc))
@@ -393,7 +393,7 @@ namespace Lucene.Net.Search
 
             public override void Copy(int slot, int doc)
             {
-                sbyte v2 = currentReaderValues.Get(doc);
+                sbyte v2 = (sbyte)currentReaderValues.Get(doc);
                 // Test for v2 == 0 to save Bits.get method call for
                 // the common case (doc has value and value is non-zero):
                 if (m_docsWithField != null && v2 == 0 && !m_docsWithField.Get(doc))
@@ -428,7 +428,7 @@ namespace Lucene.Net.Search
 
             public override int CompareTop(int doc)
             {
-                sbyte docValue = currentReaderValues.Get(doc);
+                sbyte docValue = (sbyte)currentReaderValues.Get(doc);
                 // Test for docValue == 0 to save Bits.get method call for
                 // the common case (doc has value and value is non-zero):
                 if (m_docsWithField != null && docValue == 0 && !m_docsWithField.Get(doc))

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/91c75cd9/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs b/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs
index f9cecc2..e7aa7c4 100644
--- a/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs
+++ b/src/Lucene.Net.Queries/Function/ValueSources/ByteFieldSource.cs
@@ -76,7 +76,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
             /// </summary>
             public override short Int16Val(int doc)
             {
-                return (short)arr.Get(doc);
+                return (short)(sbyte)arr.Get(doc);
             }
 
             /// <summary>
@@ -84,7 +84,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
             /// </summary>
             public override float SingleVal(int doc)
             {
-                return (float)arr.Get(doc);
+                return (float)(sbyte)arr.Get(doc);
             }
 
             /// <summary>
@@ -92,7 +92,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
             /// </summary>
             public override int Int32Val(int doc)
             {
-                return (int)arr.Get(doc);
+                return (int)(sbyte)arr.Get(doc);
             }
 
             /// <summary>
@@ -100,17 +100,17 @@ namespace Lucene.Net.Queries.Function.ValueSources
             /// </summary>
             public override long Int64Val(int doc)
             {
-                return (long)arr.Get(doc);
+                return (long)(sbyte)arr.Get(doc);
             }
 
             public override double DoubleVal(int doc)
             {
-                return (double)arr.Get(doc);
+                return (double)(sbyte)arr.Get(doc);
             }
 
             public override string StrVal(int doc)
             {
-                return Convert.ToString(arr.Get(doc));
+                return Convert.ToString((sbyte)arr.Get(doc));
             }
 
             public override string ToString(int doc)
@@ -120,7 +120,7 @@ namespace Lucene.Net.Queries.Function.ValueSources
 
             public override object ObjectVal(int doc)
             {
-                return arr.Get(doc); // TODO: valid?
+                return (sbyte)arr.Get(doc); // TODO: valid?
             }
 
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/91c75cd9/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs b/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs
index 40cc370..b7c7f70 100644
--- a/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs
+++ b/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs
@@ -141,7 +141,7 @@ namespace Lucene.Net.Index
                         {
 #pragma warning disable 612, 618
                             case 0:
-                                Assert.AreEqual((long)(sbyte)Numbers[docID], FieldCache.DEFAULT.GetBytes(Ar,
"number", false).Get(docID));
+                                Assert.AreEqual((long)(sbyte)Numbers[docID], (sbyte)FieldCache.DEFAULT.GetBytes(Ar,
"number", false).Get(docID));
                                 break;
 
                             case 1:

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/91c75cd9/src/Lucene.Net.Tests/Search/TestFieldCache.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestFieldCache.cs b/src/Lucene.Net.Tests/Search/TestFieldCache.cs
index 8e35474..ac76518 100644
--- a/src/Lucene.Net.Tests/Search/TestFieldCache.cs
+++ b/src/Lucene.Net.Tests/Search/TestFieldCache.cs
@@ -226,7 +226,7 @@ namespace Lucene.Net.Search
             Assert.AreSame(bytes, cache.GetBytes(Reader, "theByte", FieldCache.DEFAULT_BYTE_PARSER,
Random().NextBoolean()), "Second request with explicit parser return same array");
             for (int i = 0; i < NUM_DOCS; i++)
             {
-                Assert.IsTrue(bytes.Get(i) == (sbyte)(sbyte.MaxValue - i), bytes.Get(i) +
" does not equal: " + (sbyte.MaxValue - i));
+                Assert.IsTrue((sbyte)bytes.Get(i) == (sbyte)(sbyte.MaxValue - i), (sbyte)bytes.Get(i)
+ " does not equal: " + (sbyte.MaxValue - i));
             }
 
             FieldCache.Int16s shorts = cache.GetInt16s(Reader, "theShort", Random().NextBoolean());

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/91c75cd9/src/Lucene.Net.Tests/Search/TestSort.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestSort.cs b/src/Lucene.Net.Tests/Search/TestSort.cs
index 27e9f25..d9dc436 100644
--- a/src/Lucene.Net.Tests/Search/TestSort.cs
+++ b/src/Lucene.Net.Tests/Search/TestSort.cs
@@ -1617,9 +1617,9 @@ namespace Lucene.Net.Search
                 this.OuterInstance = outerInstance;
             }
 
-            public sbyte ParseByte(BytesRef term)
+            public byte ParseByte(BytesRef term)
             {
-                return (sbyte)(term.Bytes[term.Offset] - 'A');
+                return (byte)(term.Bytes[term.Offset] - 'A');
             }
 
             public TermsEnum TermsEnum(Terms terms)


Mime
View raw message