lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [lucenenet] 02/02: BREAKING: Lucene.Net.Analysis.Common.Analysis.Util.OpenStringBuilder: Updated logic of Append overloads to accept startIndex/count instead of startIndex/endIndex
Date Wed, 15 Apr 2020 12:00:34 GMT
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit d6c588594ca24b238654bfd20d9e5b7d2f77a668
Author: Shad Storhaug <shad@shadstorhaug.com>
AuthorDate: Wed Apr 15 18:49:05 2020 +0700

    BREAKING: Lucene.Net.Analysis.Common.Analysis.Util.OpenStringBuilder: Updated logic of
Append overloads to accept startIndex/count instead of startIndex/endIndex
---
 .../Analysis/Util/OpenStringBuilder.cs             | 23 +++++++++++-----------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/OpenStringBuilder.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/OpenStringBuilder.cs
index 5e5a8a4..f2601bc 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/OpenStringBuilder.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/OpenStringBuilder.cs
@@ -78,10 +78,10 @@ namespace Lucene.Net.Analysis.Util
             return Append(csq, 0, csq.Length);
         }
 
-        public virtual OpenStringBuilder Append(ICharSequence csq, int startIndex, int count)
// LUCENENET TODO: API - change to startIndex/length to match .NET
+        public virtual OpenStringBuilder Append(ICharSequence csq, int startIndex, int count)
// LUCENENET specific: changed to startIndex/length to match .NET
         {
-            EnsureCapacity(count - startIndex);
-            for (int i = startIndex; i < count; i++)
+            EnsureCapacity(count);
+            for (int i = startIndex; i < startIndex + count; i++)
             {
                 UnsafeWrite(csq[i]);
             }
@@ -95,10 +95,10 @@ namespace Lucene.Net.Analysis.Util
         }
 
         // LUCENENET specific - overload for string (more common in .NET than ICharSequence)
-        public virtual OpenStringBuilder Append(string csq, int startIndex, int count) //
LUCENENET TODO: API - change to startIndex/length to match .NET
+        public virtual OpenStringBuilder Append(string csq, int startIndex, int count) //
LUCENENET specific: changed to startIndex/length to match .NET
         {
-            EnsureCapacity(count - startIndex);
-            for (int i = startIndex; i < count; i++)
+            EnsureCapacity(count);
+            for (int i = startIndex; i < startIndex + count; i++)
             {
                 UnsafeWrite(csq[i]);
             }
@@ -112,10 +112,10 @@ namespace Lucene.Net.Analysis.Util
         }
 
         // LUCENENET specific - char sequence overload for StringBuilder
-        public virtual OpenStringBuilder Append(StringBuilder csq, int startIndex, int count)
// LUCENENET TODO: API - change to startIndex/length to match .NET
+        public virtual OpenStringBuilder Append(StringBuilder csq, int startIndex, int count)
// LUCENENET specific: changed to startIndex/length to match .NET
         {
-            EnsureCapacity(count - startIndex);
-            for (int i = startIndex; i < count; i++)
+            EnsureCapacity(count);
+            for (int i = startIndex; i < startIndex + count; i++)
             {
                 UnsafeWrite(csq[i]);
             }
@@ -132,8 +132,8 @@ namespace Lucene.Net.Analysis.Util
         // LUCENENET specific - char sequence overload for char[]
         public virtual OpenStringBuilder Append(char[] value, int startIndex, int count)
         {
-            EnsureCapacity(count - startIndex);
-            for (int i = startIndex; i < count; i++)
+            EnsureCapacity(count);
+            for (int i = startIndex; i < startIndex + count; i++)
             {
                 UnsafeWrite(value[i]);
             }
@@ -146,7 +146,6 @@ namespace Lucene.Net.Analysis.Util
             return this;
         }
 
-        
         // LUCENENET specific - removed (replaced with this[])
         //public virtual char CharAt(int index)
         //{


Mime
View raw message