lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [01/14] lucenenet git commit: Lucene.Net.Analysis.Common.Analysis.Miscellaneous.WordDelimiterIterator refactor: changed parameters and fields from sbyte to byte for CLS compliance
Date Thu, 02 Feb 2017 12:42:32 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/api-work 11a1a1c36 -> bc485b4c4


Lucene.Net.Analysis.Common.Analysis.Miscellaneous.WordDelimiterIterator refactor: changed
parameters and fields from sbyte to byte for CLS compliance


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

Branch: refs/heads/api-work
Commit: 7cd69ab00ac649081feeb814c846e9eaeb99f208
Parents: 11a1a1c
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Wed Feb 1 23:51:38 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Wed Feb 1 23:51:38 2017 +0700

----------------------------------------------------------------------
 .../Miscellaneous/Lucene47WordDelimiterFilter.cs  |  2 +-
 .../Analysis/Miscellaneous/WordDelimiterFilter.cs |  2 +-
 .../Miscellaneous/WordDelimiterFilterFactory.cs   | 12 ++++++------
 .../Miscellaneous/WordDelimiterIterator.cs        | 18 +++++++++---------
 .../Analysis/Core/TestBugInSomething.cs           |  6 +++---
 5 files changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7cd69ab0/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/Lucene47WordDelimiterFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/Lucene47WordDelimiterFilter.cs
b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/Lucene47WordDelimiterFilter.cs
index 219db723..d46b6c5 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/Lucene47WordDelimiterFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/Lucene47WordDelimiterFilter.cs
@@ -155,7 +155,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
         /// <param name="charTypeTable"> table containing character types </param>
         /// <param name="configurationFlags"> Flags configuring the filter </param>
         /// <param name="protWords"> If not null is the set of tokens to protect from
being delimited </param>
-        public Lucene47WordDelimiterFilter(TokenStream @in, sbyte[] charTypeTable, int configurationFlags,
CharArraySet protWords)
+        public Lucene47WordDelimiterFilter(TokenStream @in, byte[] charTypeTable, int configurationFlags,
CharArraySet protWords)
             : base(@in)
         {
             termAttribute = AddAttribute<ICharTermAttribute>();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7cd69ab0/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilter.cs
b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilter.cs
index d002ab2..77f643e 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilter.cs
@@ -206,7 +206,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
         /// <param name="charTypeTable"> table containing character types </param>
         /// <param name="configurationFlags"> Flags configuring the filter </param>
         /// <param name="protWords"> If not null is the set of tokens to protect from
being delimited </param>
-        public WordDelimiterFilter(LuceneVersion matchVersion, TokenStream @in, sbyte[] charTypeTable,
int configurationFlags, CharArraySet protWords)
+        public WordDelimiterFilter(LuceneVersion matchVersion, TokenStream @in, byte[] charTypeTable,
int configurationFlags, CharArraySet protWords)
               : base(@in)
         {
             InitializeInstanceFields();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7cd69ab0/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilterFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilterFactory.cs
b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilterFactory.cs
index b9aaf96..ce4959c 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterFilterFactory.cs
@@ -48,7 +48,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
         private readonly string wordFiles;
         private readonly string types;
         private readonly int flags;
-        internal sbyte[] typeTable = null;
+        internal byte[] typeTable = null;
         private CharArraySet protectedWords = null;
 
         /// <summary>
@@ -142,9 +142,9 @@ namespace Lucene.Net.Analysis.Miscellaneous
         private static Regex typePattern = new Regex("(.*)\\s*=>\\s*(.*)\\s*$", RegexOptions.Compiled);
 
         // parses a list of MappingCharFilter style rules into a custom byte[] type table
-        private sbyte[] ParseTypes(IList<string> rules)
+        private byte[] ParseTypes(IList<string> rules)
         {
-            IDictionary<char, sbyte> typeMap = new SortedDictionary<char, sbyte>();
+            IDictionary<char, byte> typeMap = new SortedDictionary<char, byte>();
             foreach (string rule in rules)
             {
                 //Matcher m = typePattern.matcher(rule);
@@ -155,7 +155,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
                     throw new System.ArgumentException("Invalid Mapping Rule : [" + rule
+ "]");
                 }
                 string lhs = ParseString(m.Groups[1].Value.Trim());
-                sbyte rhs = ParseType(m.Groups[2].Value.Trim());
+                byte rhs = ParseType(m.Groups[2].Value.Trim());
                 if (lhs.Length != 1)
                 {
                     throw new System.ArgumentException("Invalid Mapping Rule : [" + rule
+ "]. Only a single character is allowed.");
@@ -168,7 +168,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
             }
 
             // ensure the table is always at least as big as DEFAULT_WORD_DELIM_TABLE for
performance
-            sbyte[] types = new sbyte[Math.Max(typeMap.Keys.LastOrDefault() + 1, WordDelimiterIterator.DEFAULT_WORD_DELIM_TABLE.Length)];
+            byte[] types = new byte[Math.Max(typeMap.Keys.LastOrDefault() + 1, WordDelimiterIterator.DEFAULT_WORD_DELIM_TABLE.Length)];
             for (int i = 0; i < types.Length; i++)
             {
                 types[i] = WordDelimiterIterator.GetType(i);
@@ -180,7 +180,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
             return types;
         }
 
-        private sbyte ParseType(string s)
+        private byte ParseType(string s)
         {
             if (s.Equals("LOWER"))
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7cd69ab0/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterIterator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterIterator.cs
b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterIterator.cs
index 46c43a1..3fe61b6 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterIterator.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/WordDelimiterIterator.cs
@@ -30,7 +30,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
         /// Indicates the end of iteration </summary>
         public const int DONE = -1;
 
-        public static readonly sbyte[] DEFAULT_WORD_DELIM_TABLE;
+        public static readonly byte[] DEFAULT_WORD_DELIM_TABLE;
 
         internal char[] text;
         internal int length;
@@ -71,7 +71,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
         /// </summary>
         internal readonly bool stemEnglishPossessive;
 
-        private readonly sbyte[] charTypeTable;
+        private readonly byte[] charTypeTable;
 
         /// <summary>
         /// if true, need to skip over a possessive found in the last call to next() </summary>
@@ -81,21 +81,21 @@ namespace Lucene.Net.Analysis.Miscellaneous
         // done if separated by these chars?) "," would be an obvious candidate...
         static WordDelimiterIterator()
         {
-            var tab = new sbyte[256];
+            var tab = new byte[256];
             for (int i = 0; i < 256; i++)
             {
-                sbyte code = 0;
+                byte code = 0;
                 if (char.IsLower((char)i))
                 {
-                    code |= (sbyte)WordDelimiterFilter.LOWER;
+                    code |= (byte)WordDelimiterFilter.LOWER;
                 }
                 else if (char.IsUpper((char)i))
                 {
-                    code |= (sbyte)WordDelimiterFilter.UPPER;
+                    code |= (byte)WordDelimiterFilter.UPPER;
                 }
                 else if (char.IsDigit((char)i))
                 {
-                    code |= (sbyte)WordDelimiterFilter.DIGIT;
+                    code |= (byte)WordDelimiterFilter.DIGIT;
                 }
                 if (code == 0)
                 {
@@ -113,7 +113,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
         /// <param name="splitOnCaseChange"> if true, causes "PowerShot" to be two
tokens; ("Power-Shot" remains two parts regards) </param>
         /// <param name="splitOnNumerics"> if true, causes "j2se" to be three tokens;
"j" "2" "se" </param>
         /// <param name="stemEnglishPossessive"> if true, causes trailing "'s" to be
removed for each subword: "O'Neil's" => "O", "Neil" </param>
-        internal WordDelimiterIterator(sbyte[] charTypeTable, bool splitOnCaseChange, bool
splitOnNumerics, bool stemEnglishPossessive)
+        internal WordDelimiterIterator(byte[] charTypeTable, bool splitOnCaseChange, bool
splitOnNumerics, bool stemEnglishPossessive)
         {
             this.charTypeTable = charTypeTable;
             this.splitOnCaseChange = splitOnCaseChange;
@@ -315,7 +315,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
         /// </summary>
         /// <param name="ch"> Character whose type is to be determined </param>
         /// <returns> Type of the character </returns>
-        public static sbyte GetType(int ch)
+        public static byte GetType(int ch)
         {
             switch (CharUnicodeInfo.GetUnicodeCategory((char)ch))
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7cd69ab0/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
index e552384..1a7f7e9 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Core/TestBugInSomething.cs
@@ -333,7 +333,7 @@ namespace Lucene.Net.Analysis.Core
         public virtual void TestCuriousWikipediaString()
         {
             CharArraySet protWords = new CharArraySet(TEST_VERSION_CURRENT, new HashSet<string>(Arrays.AsList("rrdpafa",
"pupmmlu", "xlq", "dyy", "zqrxrrck", "o", "hsrlfvcha")), false);
-            sbyte[] table = new sbyte[] { -57, 26, 1, 48, 63, -23, 55, -84, 18, 120, -97,
103, 58, 13, 84, 89, 57, -13, -63, 5, 28, 97, -54, -94, 102, -108, -5, 5, 46, 40, 43, 78,
43, -72, 36, 29, 124, -106, -22, -51, 65, 5, 31, -42, 6, -99, 97, 14, 81, -128, 74, 100, 54,
-55, -25, 53, -71, -98, 44, 33, 86, 106, -42, 47, 115, -89, -18, -26, 22, -95, -43, 83, -125,
105, -104, -24, 106, -16, 126, 115, -105, 97, 65, -33, 57, 44, -1, 123, -68, 100, 13, -41,
-64, -119, 0, 92, 94, -36, 53, -9, -102, -18, 90, 94, -26, 31, 71, -20 };
+            byte[] table = (byte[])(Array)new sbyte[] { -57, 26, 1, 48, 63, -23, 55, -84,
18, 120, -97, 103, 58, 13, 84, 89, 57, -13, -63, 5, 28, 97, -54, -94, 102, -108, -5, 5, 46,
40, 43, 78, 43, -72, 36, 29, 124, -106, -22, -51, 65, 5, 31, -42, 6, -99, 97, 14, 81, -128,
74, 100, 54, -55, -25, 53, -71, -98, 44, 33, 86, 106, -42, 47, 115, -89, -18, -26, 22, -95,
-43, 83, -125, 105, -104, -24, 106, -16, 126, 115, -105, 97, 65, -33, 57, 44, -1, 123, -68,
100, 13, -41, -64, -119, 0, 92, 94, -36, 53, -9, -102, -18, 90, 94, -26, 31, 71, -20 };
             Analyzer a = new AnalyzerAnonymousInnerClassHelper2(this, protWords, table);
             CheckAnalysisConsistency(Random(), a, false, "B\u28c3\ue0f8[ \ud800\udfc2 </p>
jb");
         }
@@ -343,9 +343,9 @@ namespace Lucene.Net.Analysis.Core
             private readonly TestBugInSomething outerInstance;
 
             private CharArraySet protWords;
-            private sbyte[] table;
+            private byte[] table;
 
-            public AnalyzerAnonymousInnerClassHelper2(TestBugInSomething outerInstance, CharArraySet
protWords, sbyte[] table)
+            public AnalyzerAnonymousInnerClassHelper2(TestBugInSomething outerInstance, CharArraySet
protWords, byte[] table)
             {
                 this.outerInstance = outerInstance;
                 this.protWords = protWords;


Mime
View raw message