lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [16/53] [abbrv] lucenenet git commit: Lucene.Net.Highlighter: Renamed all type-derived properties and methods from Short, Int, Long, and Float to match CLR types Int16, Int32, Int64, and Single, respectively.
Date Wed, 08 Feb 2017 14:31:55 GMT
Lucene.Net.Highlighter: Renamed all type-derived properties and methods from Short, Int, Long,
and Float to match CLR types Int16, Int32, Int64, and Single, respectively.


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

Branch: refs/heads/api-work
Commit: 76f687c4402a15530453778315a9de243e90960f
Parents: 67f5e6c
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Wed Feb 8 00:35:05 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Wed Feb 8 21:08:21 2017 +0700

----------------------------------------------------------------------
 .../Highlight/GradientFormatter.cs              | 47 +++++++++++---------
 .../Highlight/HighlighterTest.cs                |  2 +-
 2 files changed, 27 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/76f687c4/src/Lucene.Net.Highlighter/Highlight/GradientFormatter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Highlighter/Highlight/GradientFormatter.cs b/src/Lucene.Net.Highlighter/Highlight/GradientFormatter.cs
index fe386ca..a666e33 100644
--- a/src/Lucene.Net.Highlighter/Highlight/GradientFormatter.cs
+++ b/src/Lucene.Net.Highlighter/Highlight/GradientFormatter.cs
@@ -73,13 +73,13 @@ namespace Lucene.Net.Search.Highlight
                     throw new ArgumentException("minForegroundColor is not 7 bytes long eg
a hex " 
                         + "RGB value such as #FFFFFF");
                 }
-                m_fgRMin = HexToInt(minForegroundColor.Substring(1, 3 - 1));
-                m_fgGMin = HexToInt(minForegroundColor.Substring(3, 5 - 3));
-                m_fgBMin = HexToInt(minForegroundColor.Substring(5, 7 - 5));
+                m_fgRMin = HexToInt32(minForegroundColor.Substring(1, 3 - 1));
+                m_fgGMin = HexToInt32(minForegroundColor.Substring(3, 5 - 3));
+                m_fgBMin = HexToInt32(minForegroundColor.Substring(5, 7 - 5));
 
-                m_fgRMax = HexToInt(maxForegroundColor.Substring(1, 3 - 1));
-                m_fgGMax = HexToInt(maxForegroundColor.Substring(3, 5 - 3));
-                m_fgBMax = HexToInt(maxForegroundColor.Substring(5, 7 - 5));
+                m_fgRMax = HexToInt32(maxForegroundColor.Substring(1, 3 - 1));
+                m_fgGMax = HexToInt32(maxForegroundColor.Substring(3, 5 - 3));
+                m_fgBMax = HexToInt32(maxForegroundColor.Substring(5, 7 - 5));
             }
 
             m_highlightBackground = (minBackgroundColor != null) 
@@ -96,13 +96,13 @@ namespace Lucene.Net.Search.Highlight
                     throw new ArgumentException("minBackgroundColor is not 7 bytes long eg
a hex " 
                         + "RGB value such as #FFFFFF");
                 }
-                m_bgRMin = HexToInt(minBackgroundColor.Substring(1, 3 - 1));
-                m_bgGMin = HexToInt(minBackgroundColor.Substring(3, 5 - 3));
-                m_bgBMin = HexToInt(minBackgroundColor.Substring(5, 7 - 5));
+                m_bgRMin = HexToInt32(minBackgroundColor.Substring(1, 3 - 1));
+                m_bgGMin = HexToInt32(minBackgroundColor.Substring(3, 5 - 3));
+                m_bgBMin = HexToInt32(minBackgroundColor.Substring(5, 7 - 5));
 
-                m_bgRMax = HexToInt(maxBackgroundColor.Substring(1, 3 - 1));
-                m_bgGMax = HexToInt(maxBackgroundColor.Substring(3, 5 - 3));
-                m_bgBMax = HexToInt(maxBackgroundColor.Substring(5, 7 - 5));
+                m_bgRMax = HexToInt32(maxBackgroundColor.Substring(1, 3 - 1));
+                m_bgGMax = HexToInt32(maxBackgroundColor.Substring(3, 5 - 3));
+                m_bgBMax = HexToInt32(maxBackgroundColor.Substring(5, 7 - 5));
             }
             //        this.corpusReader = corpusReader;
             this.maxScore = maxScore;
@@ -146,9 +146,9 @@ namespace Lucene.Net.Search.Highlight
             int bVal = GetColorVal(m_fgBMin, m_fgBMax, score);
             var sb = new StringBuilder();
             sb.Append("#");
-            sb.Append(IntToHex(rVal));
-            sb.Append(IntToHex(gVal));
-            sb.Append(IntToHex(bVal));
+            sb.Append(Int32ToHex(rVal));
+            sb.Append(Int32ToHex(gVal));
+            sb.Append(Int32ToHex(bVal));
             return sb.ToString();
         }
 
@@ -159,9 +159,9 @@ namespace Lucene.Net.Search.Highlight
             int bVal = GetColorVal(m_bgBMin, m_bgBMax, score);
             var sb = new StringBuilder();
             sb.Append("#");
-            sb.Append(IntToHex(rVal));
-            sb.Append(IntToHex(gVal));
-            sb.Append(IntToHex(bVal));
+            sb.Append(Int32ToHex(rVal));
+            sb.Append(Int32ToHex(gVal));
+            sb.Append(Int32ToHex(bVal));
             return sb.ToString();
         }
 
@@ -180,13 +180,18 @@ namespace Lucene.Net.Search.Highlight
         private static char[] hexDigits = new char[] { '0', '1', '2', '3', '4', '5', '6',
'7',
             '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
 
-        private static string IntToHex(int i)
+        /// <summary>
+        /// NOTE: This was intToHex() in Lucene
+        /// </summary>
+        private static string Int32ToHex(int i)
         {
             return "" + hexDigits[(i & 0xF0) >> 4] + hexDigits[i & 0x0F];
         }
 
         /// <summary> 
-        /// Converts a hex string into an <see cref="int"/>. 
+        /// Converts a hex string into an <see cref="int"/>.
+        /// <para/>
+        /// NOTE: This was hexToInt() in Lucene
         /// </summary>
         /// <param name="hex">
         /// A string in capital or lower case hex, of no more then 16
@@ -194,7 +199,7 @@ namespace Lucene.Net.Search.Highlight
         /// </param>
         /// <exception cref="FormatException">if the string is more than 16 characters
long, or if any
         /// character is not in the set [0-9a-fA-f]</exception>
-        public static int HexToInt(string hex)
+        public static int HexToInt32(string hex)
         {
             int len = hex.Length;
             if (len > 16)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/76f687c4/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs b/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs
index 84d00a8..33fe884 100644
--- a/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs
+++ b/src/Lucene.Net.Tests.Highlighter/Highlight/HighlighterTest.cs
@@ -2026,7 +2026,7 @@ namespace Lucene.Net.Search.Highlight
         [Test, LuceneNetSpecific]
         public void TestGradientHighlighterHexToInt()
         {
-            int result = GradientFormatter.HexToInt("#CFFFFF".Substring(1, 3 - 1));
+            int result = GradientFormatter.HexToInt32("#CFFFFF".Substring(1, 3 - 1));
 
             assertEquals(207, result);
         }


Mime
View raw message