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 2017/02/04 20:32:48 UTC

[29/39] lucenenet git commit: Lucene.Net.Analysis.Util.OpenStringBuilder refactor: Removed Count property which was formerly size() - we already have a Length property. And since StringBuilder uses Length, that one is preferred.

Lucene.Net.Analysis.Util.OpenStringBuilder refactor: Removed Count property which was formerly size() - we already have a Length property. And since StringBuilder uses Length, that one is preferred.


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

Branch: refs/heads/api-work
Commit: 4e209cdc56eb94bf641629af36faf1c2641a3be6
Parents: e3efbd0
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sun Feb 5 01:32:15 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Feb 5 01:32:15 2017 +0700

----------------------------------------------------------------------
 .../Analysis/En/KStemmer.cs                      |  2 +-
 .../Analysis/Util/OpenStringBuilder.cs           | 19 ++++++++++---------
 2 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4e209cdc/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs b/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs
index 250af5b..9173a2a 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/En/KStemmer.cs
@@ -778,7 +778,7 @@ namespace Lucene.Net.Analysis.En
             // thisLookup); } else { // System.out.println("new lookup:" + thisLookup);
             // }
 
-            matchedEntry = dict_ht.Get(word.Array, 0, word.Count);
+            matchedEntry = dict_ht.Get(word.Array, 0, word.Length);
             return matchedEntry != null;
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4e209cdc/src/Lucene.Net.Analysis.Common/Analysis/Util/OpenStringBuilder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/OpenStringBuilder.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/OpenStringBuilder.cs
index fc73055..b930b3f 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/OpenStringBuilder.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/OpenStringBuilder.cs
@@ -69,11 +69,12 @@ namespace Lucene.Net.Analysis.Util
             }
         }
 
-        // LUCENENE TODO: Change to Length (StringBuilder uses Length in .NET)
-        public virtual int Count // LUCENENET NOTE: This was size() in Lucene.
-        {
-            get{ return m_len; }
-        }
+        // LUCENENE NOTE: This is essentially a duplicate of Length (except that property can be set).
+        // .NET uses Length for StringBuilder anyway, so that property is preferable to this one.
+        //public virtual int Count // LUCENENET NOTE: This was size() in Lucene.
+        //{
+        //    get{ return m_len; }
+        //}
 
         public virtual int Capacity
         {
@@ -142,7 +143,7 @@ namespace Lucene.Net.Analysis.Util
         protected virtual void Resize(int len)
         {
             char[] newbuf = new char[Math.Max(m_buf.Length << 1, len)];
-            System.Array.Copy(m_buf, 0, newbuf, 0, Count);
+            System.Array.Copy(m_buf, 0, newbuf, 0, Length);
             m_buf = newbuf;
         }
 
@@ -202,14 +203,14 @@ namespace Lucene.Net.Analysis.Util
 
         public virtual char[] ToCharArray()
         {
-            char[] newbuf = new char[Count];
-            System.Array.Copy(m_buf, 0, newbuf, 0, Count);
+            char[] newbuf = new char[Length];
+            System.Array.Copy(m_buf, 0, newbuf, 0, Length);
             return newbuf;
         }
 
         public override string ToString()
         {
-            return new string(m_buf, 0, Count);
+            return new string(m_buf, 0, Length);
         }
     }
 }
\ No newline at end of file