lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [11/28] lucenenet git commit: Lucene.Net.Highlighter refactor: renamed all protected fields camelCase prefixed with m_
Date Wed, 01 Feb 2017 10:22:08 GMT
Lucene.Net.Highlighter refactor: renamed all protected fields camelCase prefixed with m_


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

Branch: refs/heads/api-work
Commit: 350040c8356e18de4be8ca7f15df371b051cb552
Parents: fcf634f
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Wed Feb 1 14:02:02 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Wed Feb 1 14:02:02 2017 +0700

----------------------------------------------------------------------
 .../Highlight/GradientFormatter.cs              | 60 ++++++++++----------
 .../Highlight/SpanGradientFormatter.cs          |  4 +-
 src/Lucene.Net.Highlighter/IcuBreakIterator.cs  | 20 +++----
 .../DefaultPassageFormatter.cs                  | 26 ++++-----
 .../VectorHighlight/BaseFragmentsBuilder.cs     | 14 ++---
 .../VectorHighlight/SimpleBoundaryScanner.cs    | 22 +++----
 6 files changed, 73 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/350040c8/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 e94a309..fe386ca 100644
--- a/src/Lucene.Net.Highlighter/Highlight/GradientFormatter.cs
+++ b/src/Lucene.Net.Highlighter/Highlight/GradientFormatter.cs
@@ -27,12 +27,12 @@ namespace Lucene.Net.Search.Highlight
     {
         private float maxScore;
 
-        protected internal int fgRMin, fgGMin, fgBMin;
-        protected internal int fgRMax, fgGMax, fgBMax;
-        protected bool highlightForeground;
-        protected internal int bgRMin, bgGMin, bgBMin;
-        protected internal int bgRMax, bgGMax, bgBMax;
-        protected bool highlightBackground;
+        protected int m_fgRMin, m_fgGMin, m_fgBMin;
+        protected int m_fgRMax, m_fgGMax, m_fgBMax;
+        protected bool m_highlightForeground;
+        protected int m_bgRMin, m_bgGMin, m_bgBMin;
+        protected int m_bgRMax, m_bgGMax, m_bgBMax;
+        protected bool m_highlightBackground;
 
         /// <summary> Sets the color range for the IDF scores</summary>
         /// <param name="maxScore">
@@ -59,9 +59,9 @@ namespace Lucene.Net.Search.Highlight
             string maxForegroundColor, string minBackgroundColor, 
             string maxBackgroundColor)
         {
-            highlightForeground = (minForegroundColor != null) && (maxForegroundColor
!= null);
+            m_highlightForeground = (minForegroundColor != null) && (maxForegroundColor
!= null);
 
-            if (highlightForeground)
+            if (m_highlightForeground)
             {
                 if (minForegroundColor.Length != 7)
                 {
@@ -73,18 +73,18 @@ namespace Lucene.Net.Search.Highlight
                     throw new ArgumentException("minForegroundColor is not 7 bytes long eg
a hex " 
                         + "RGB value such as #FFFFFF");
                 }
-                fgRMin = HexToInt(minForegroundColor.Substring(1, 3 - 1));
-                fgGMin = HexToInt(minForegroundColor.Substring(3, 5 - 3));
-                fgBMin = HexToInt(minForegroundColor.Substring(5, 7 - 5));
+                m_fgRMin = HexToInt(minForegroundColor.Substring(1, 3 - 1));
+                m_fgGMin = HexToInt(minForegroundColor.Substring(3, 5 - 3));
+                m_fgBMin = HexToInt(minForegroundColor.Substring(5, 7 - 5));
 
-                fgRMax = HexToInt(maxForegroundColor.Substring(1, 3 - 1));
-                fgGMax = HexToInt(maxForegroundColor.Substring(3, 5 - 3));
-                fgBMax = HexToInt(maxForegroundColor.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));
             }
 
-            highlightBackground = (minBackgroundColor != null) 
+            m_highlightBackground = (minBackgroundColor != null) 
                 && (maxBackgroundColor != null);
-            if (highlightBackground)
+            if (m_highlightBackground)
             {
                 if (minBackgroundColor.Length != 7)
                 {
@@ -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");
                 }
-                bgRMin = HexToInt(minBackgroundColor.Substring(1, 3 - 1));
-                bgGMin = HexToInt(minBackgroundColor.Substring(3, 5 - 3));
-                bgBMin = HexToInt(minBackgroundColor.Substring(5, 7 - 5));
+                m_bgRMin = HexToInt(minBackgroundColor.Substring(1, 3 - 1));
+                m_bgGMin = HexToInt(minBackgroundColor.Substring(3, 5 - 3));
+                m_bgBMin = HexToInt(minBackgroundColor.Substring(5, 7 - 5));
 
-                bgRMax = HexToInt(maxBackgroundColor.Substring(1, 3 - 1));
-                bgGMax = HexToInt(maxBackgroundColor.Substring(3, 5 - 3));
-                bgBMax = HexToInt(maxBackgroundColor.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));
             }
             //        this.corpusReader = corpusReader;
             this.maxScore = maxScore;
@@ -121,13 +121,13 @@ namespace Lucene.Net.Search.Highlight
 
             var sb = new StringBuilder();
             sb.Append("<font ");
-            if (highlightForeground)
+            if (m_highlightForeground)
             {
                 sb.Append("color=\"");
                 sb.Append(GetForegroundColorString(score));
                 sb.Append("\" ");
             }
-            if (highlightBackground)
+            if (m_highlightBackground)
             {
                 sb.Append("bgcolor=\"");
                 sb.Append(GetBackgroundColorString(score));
@@ -141,9 +141,9 @@ namespace Lucene.Net.Search.Highlight
 
         protected internal virtual string GetForegroundColorString(float score)
         {
-            int rVal = GetColorVal(fgRMin, fgRMax, score);
-            int gVal = GetColorVal(fgGMin, fgGMax, score);
-            int bVal = GetColorVal(fgBMin, fgBMax, score);
+            int rVal = GetColorVal(m_fgRMin, m_fgRMax, score);
+            int gVal = GetColorVal(m_fgGMin, m_fgGMax, score);
+            int bVal = GetColorVal(m_fgBMin, m_fgBMax, score);
             var sb = new StringBuilder();
             sb.Append("#");
             sb.Append(IntToHex(rVal));
@@ -154,9 +154,9 @@ namespace Lucene.Net.Search.Highlight
 
         protected internal virtual string GetBackgroundColorString(float score)
         {
-            int rVal = GetColorVal(bgRMin, bgRMax, score);
-            int gVal = GetColorVal(bgGMin, bgGMax, score);
-            int bVal = GetColorVal(bgBMin, bgBMax, score);
+            int rVal = GetColorVal(m_bgRMin, m_bgRMax, score);
+            int gVal = GetColorVal(m_bgGMin, m_bgGMax, score);
+            int bVal = GetColorVal(m_bgBMin, m_bgBMax, score);
             var sb = new StringBuilder();
             sb.Append("#");
             sb.Append(IntToHex(rVal));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/350040c8/src/Lucene.Net.Highlighter/Highlight/SpanGradientFormatter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Highlighter/Highlight/SpanGradientFormatter.cs b/src/Lucene.Net.Highlighter/Highlight/SpanGradientFormatter.cs
index 731f23f..9a5e42b 100644
--- a/src/Lucene.Net.Highlighter/Highlight/SpanGradientFormatter.cs
+++ b/src/Lucene.Net.Highlighter/Highlight/SpanGradientFormatter.cs
@@ -51,13 +51,13 @@ namespace Lucene.Net.Search.Highlight
             var sb = new StringBuilder(originalText.Length + EXTRA);
 
             sb.Append("<span style=\"");
-            if (highlightForeground)
+            if (m_highlightForeground)
             {
                 sb.Append("color: ");
                 sb.Append(GetForegroundColorString(score));
                 sb.Append("; ");
             }
-            if (highlightBackground)
+            if (m_highlightBackground)
             {
                 sb.Append("background: ");
                 sb.Append(GetBackgroundColorString(score));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/350040c8/src/Lucene.Net.Highlighter/IcuBreakIterator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Highlighter/IcuBreakIterator.cs b/src/Lucene.Net.Highlighter/IcuBreakIterator.cs
index 5b78790..72e89b0 100644
--- a/src/Lucene.Net.Highlighter/IcuBreakIterator.cs
+++ b/src/Lucene.Net.Highlighter/IcuBreakIterator.cs
@@ -43,12 +43,12 @@ namespace Lucene.Net.Search
         /// <summary>
         /// The start offset for the string, if supplied by a <see cref="CharacterIterator"/>
         /// </summary>
-        protected int start;
+        protected int m_start;
 
         /// <summary>
         /// The end offset for the string, if supplied by a <see cref="CharacterIterator"/>
         /// </summary>
-        protected int end;
+        protected int m_end;
 
         public IcuBreakIterator(Icu.BreakIterator.UBreakIteratorType type)
             : this(type, CultureInfo.CurrentCulture)
@@ -142,7 +142,7 @@ namespace Lucene.Net.Search
         /// <param name="offset"></param>
         private void CheckOffset(int offset)
         {
-            if (offset < start || offset > end)
+            if (offset < m_start || offset > m_end)
             {
                 throw new ArgumentException("offset out of bounds");
             }
@@ -262,20 +262,20 @@ namespace Lucene.Net.Search
         {
             text = newText;
             currentBoundaryIndex = 0;
-            start = 0;
-            end = newText.Length;
+            m_start = 0;
+            m_end = newText.Length;
 
-            LoadBoundaries(start, end);
+            LoadBoundaries(m_start, m_end);
         }
 
         public override void SetText(CharacterIterator newText)
         {
             text = newText.GetTextAsString();
             currentBoundaryIndex = 0;
-            start = newText.BeginIndex;
-            end = newText.EndIndex;
+            m_start = newText.BeginIndex;
+            m_end = newText.EndIndex;
 
-            LoadBoundaries(start, end);
+            LoadBoundaries(m_start, m_end);
         }
 
         private void LoadBoundaries(int start, int end)
@@ -333,7 +333,7 @@ namespace Lucene.Net.Search
             }
 
             // If there are no boundaries, we must return the start offset
-            return start;
+            return m_start;
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/350040c8/src/Lucene.Net.Highlighter/PostingsHighlight/DefaultPassageFormatter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Highlighter/PostingsHighlight/DefaultPassageFormatter.cs b/src/Lucene.Net.Highlighter/PostingsHighlight/DefaultPassageFormatter.cs
index a0bcde0..4538d46 100644
--- a/src/Lucene.Net.Highlighter/PostingsHighlight/DefaultPassageFormatter.cs
+++ b/src/Lucene.Net.Highlighter/PostingsHighlight/DefaultPassageFormatter.cs
@@ -29,13 +29,13 @@ namespace Lucene.Net.Search.PostingsHighlight
     public class DefaultPassageFormatter : PassageFormatter
     {
         /// <summary>text that will appear before highlighted terms</summary>
-        protected readonly string preTag;
+        protected readonly string m_preTag;
         /// <summary>text that will appear after highlighted terms</summary>
-        protected readonly string postTag;
+        protected readonly string m_postTag;
         /// <summary>text that will appear between two unconnected passages</summary>
-        protected readonly string ellipsis;
+        protected readonly string m_ellipsis;
         /// <summary>true if we should escape for html</summary>
-        protected readonly bool escape;
+        protected readonly bool m_escape;
 
         /// <summary>
         /// Creates a new DefaultPassageFormatter with the default tags.
@@ -58,10 +58,10 @@ namespace Lucene.Net.Search.PostingsHighlight
             {
                 throw new ArgumentException(); //throw new NullPointerException();
             }
-            this.preTag = preTag;
-            this.postTag = postTag;
-            this.ellipsis = ellipsis;
-            this.escape = escape;
+            this.m_preTag = preTag;
+            this.m_postTag = postTag;
+            this.m_ellipsis = ellipsis;
+            this.m_escape = escape;
         }
 
         public override object Format(Passage[] passages, string content)
@@ -73,7 +73,7 @@ namespace Lucene.Net.Search.PostingsHighlight
                 // don't add ellipsis if its the first one, or if its connected.
                 if (passage.startOffset > pos && pos > 0)
                 {
-                    sb.Append(ellipsis);
+                    sb.Append(m_ellipsis);
                 }
                 pos = passage.startOffset;
                 for (int i = 0; i < passage.numMatches; i++)
@@ -87,9 +87,9 @@ namespace Lucene.Net.Search.PostingsHighlight
                     }
                     if (end > pos)
                     {
-                        sb.Append(preTag);
+                        sb.Append(m_preTag);
                         Append(sb, content, Math.Max(pos, start), end);
-                        sb.Append(postTag);
+                        sb.Append(m_postTag);
                         pos = end;
                     }
                 }
@@ -107,9 +107,9 @@ namespace Lucene.Net.Search.PostingsHighlight
         /// <param name="content">original text content</param>
         /// <param name="start">index of the first character in content</param>
         /// <param name="end">index of the character following the last character in
content</param>
-        protected virtual void Append(StringBuilder dest, String content, int start, int
end)
+        protected virtual void Append(StringBuilder dest, string content, int start, int
end)
         {
-            if (escape)
+            if (m_escape)
             {
                 // note: these are the rules from owasp.org
                 for (int i = start; i < end; i++)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/350040c8/src/Lucene.Net.Highlighter/VectorHighlight/BaseFragmentsBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/BaseFragmentsBuilder.cs b/src/Lucene.Net.Highlighter/VectorHighlight/BaseFragmentsBuilder.cs
index c8c88cf..696cf7d 100644
--- a/src/Lucene.Net.Highlighter/VectorHighlight/BaseFragmentsBuilder.cs
+++ b/src/Lucene.Net.Highlighter/VectorHighlight/BaseFragmentsBuilder.cs
@@ -38,7 +38,7 @@ namespace Lucene.Net.Search.VectorHighlight
     /// </summary>
     public abstract class BaseFragmentsBuilder : IFragmentsBuilder
     {
-        protected string[] preTags, postTags;
+        protected string[] m_preTags, m_postTags;
         public static readonly string[] COLORED_PRE_TAGS = {
             "<b style=\"background:yellow\">", "<b style=\"background:lawngreen\">",
"<b style=\"background:aquamarine\">",
             "<b style=\"background:magenta\">", "<b style=\"background:palegreen\">",
"<b style=\"background:coral\">",
@@ -70,8 +70,8 @@ namespace Lucene.Net.Search.VectorHighlight
 
         protected BaseFragmentsBuilder(string[] preTags, string[] postTags, IBoundaryScanner
boundaryScanner)
         {
-            this.preTags = preTags;
-            this.postTags = postTags;
+            this.m_preTags = preTags;
+            this.m_postTags = postTags;
             this.boundaryScanner = boundaryScanner;
         }
 
@@ -90,14 +90,14 @@ namespace Lucene.Net.Search.VectorHighlight
             string fieldName, FieldFragList fieldFragList)
         {
             return CreateFragment(reader, docId, fieldName, fieldFragList,
-                preTags, postTags, NULL_ENCODER);
+                m_preTags, m_postTags, NULL_ENCODER);
         }
 
         public virtual string[] CreateFragments(IndexReader reader, int docId,
             string fieldName, FieldFragList fieldFragList, int maxNumFragments)
         {
             return CreateFragments(reader, docId, fieldName, fieldFragList, maxNumFragments,
-                preTags, postTags, NULL_ENCODER);
+                m_preTags, m_postTags, NULL_ENCODER);
         }
 
         public virtual string CreateFragment(IndexReader reader, int docId,
@@ -373,12 +373,12 @@ namespace Lucene.Net.Search.VectorHighlight
 
         protected virtual string GetPreTag(int num)
         {
-            return GetPreTag(preTags, num);
+            return GetPreTag(m_preTags, num);
         }
 
         protected virtual string GetPostTag(int num)
         {
-            return GetPostTag(postTags, num);
+            return GetPostTag(m_postTags, num);
         }
 
         protected virtual string GetPreTag(string[] preTags, int num)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/350040c8/src/Lucene.Net.Highlighter/VectorHighlight/SimpleBoundaryScanner.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Highlighter/VectorHighlight/SimpleBoundaryScanner.cs b/src/Lucene.Net.Highlighter/VectorHighlight/SimpleBoundaryScanner.cs
index e004525..e16faa1 100644
--- a/src/Lucene.Net.Highlighter/VectorHighlight/SimpleBoundaryScanner.cs
+++ b/src/Lucene.Net.Highlighter/VectorHighlight/SimpleBoundaryScanner.cs
@@ -30,8 +30,8 @@ namespace Lucene.Net.Search.VectorHighlight
         public static readonly int DEFAULT_MAX_SCAN = 20;
         public static readonly char[] DEFAULT_BOUNDARY_CHARS = { '.', ',', '!', '?', ' ',
'\t', '\n' };
 
-        protected int maxScan;
-        protected ISet<char> boundaryChars;
+        protected int m_maxScan;
+        protected ISet<char> m_boundaryChars;
 
         public SimpleBoundaryScanner()
             : this(DEFAULT_MAX_SCAN, DEFAULT_BOUNDARY_CHARS)
@@ -50,26 +50,26 @@ namespace Lucene.Net.Search.VectorHighlight
 
         public SimpleBoundaryScanner(int maxScan, char[] boundaryChars)
         {
-            this.maxScan = maxScan;
-            this.boundaryChars = new HashSet<char>();
-            this.boundaryChars.UnionWith(Arrays.AsList(boundaryChars));
+            this.m_maxScan = maxScan;
+            this.m_boundaryChars = new HashSet<char>();
+            this.m_boundaryChars.UnionWith(Arrays.AsList(boundaryChars));
         }
 
         public SimpleBoundaryScanner(int maxScan, ISet<char> boundaryChars)
         {
-            this.maxScan = maxScan;
-            this.boundaryChars = boundaryChars;
+            this.m_maxScan = maxScan;
+            this.m_boundaryChars = boundaryChars;
         }
 
         public virtual int FindStartOffset(StringBuilder buffer, int start)
         {
             // avoid illegal start offset
             if (start > buffer.Length || start < 1) return start;
-            int offset, count = maxScan;
+            int offset, count = m_maxScan;
             for (offset = start; offset > 0 && count > 0; count--)
             {
                 // found?
-                if (boundaryChars.Contains(buffer[offset - 1])) return offset;
+                if (m_boundaryChars.Contains(buffer[offset - 1])) return offset;
                 offset--;
             }
             // if we scanned up to the start of the text, return it, its a "boundary"
@@ -85,12 +85,12 @@ namespace Lucene.Net.Search.VectorHighlight
         {
             // avoid illegal start offset
             if (start > buffer.Length || start < 0) return start;
-            int offset, count = maxScan;
+            int offset, count = m_maxScan;
             //for( offset = start; offset <= buffer.length() && count > 0;
count-- ){
             for (offset = start; offset < buffer.Length && count > 0; count--)
             {
                 // found?
-                if (boundaryChars.Contains(buffer[offset])) return offset;
+                if (m_boundaryChars.Contains(buffer[offset])) return offset;
                 offset++;
             }
             // not found


Mime
View raw message