lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [31/39] lucenenet git commit: Lucene.Net.Analysis.Util.OpenStringBuilder refactor: Added the original Append() method overloads for ICharSequence (primarily so OpenStringBuilder can work with itself), and for StringBuilder for better compatibility with .
Date Sat, 04 Feb 2017 20:32:50 GMT
Lucene.Net.Analysis.Util.OpenStringBuilder refactor: Added the original Append() method overloads
for ICharSequence (primarily so OpenStringBuilder can work with itself), and for StringBuilder
for better compatibility with .NET


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

Branch: refs/heads/api-work
Commit: 252e30cca29b71adfd0663a8e03f4828fae9af52
Parents: eedf7d8
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sun Feb 5 01:55:46 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Feb 5 01:55:46 2017 +0700

----------------------------------------------------------------------
 .../Analysis/Util/OpenStringBuilder.cs          | 39 +++++++++++++++++++-
 1 file changed, 37 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/252e30cc/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 74035ea..8987189 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/OpenStringBuilder.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/OpenStringBuilder.cs
@@ -1,6 +1,7 @@
 ´╗┐using Lucene.Net.Support;
 using System;
 using System.Diagnostics.CodeAnalysis;
+using System.Text;
 
 namespace Lucene.Net.Analysis.Util
 {
@@ -81,12 +82,46 @@ namespace Lucene.Net.Analysis.Util
             get { return m_buf.Length; }
         }
 
-        public virtual OpenStringBuilder Append(string csq) // LUCENENET TODO: Add overloads
for ICharSequence and StringBuilder
+        public virtual OpenStringBuilder Append(ICharSequence csq) 
         {
             return Append(csq, 0, csq.Length);
         }
 
-        public virtual OpenStringBuilder Append(string csq, int start, int end) // LUCENENET
TODO: Add overloads for ICharSequence and StringBuilder
+        public virtual OpenStringBuilder Append(ICharSequence csq, int start, int end)
+        {
+            Reserve(end - start);
+            for (int i = start; i < end; i++)
+            {
+                UnsafeWrite(csq[i]);
+            }
+            return this;
+        }
+
+        // LUCENENET specific - overload for string (more common in .NET than ICharSequence)
+        public virtual OpenStringBuilder Append(string csq)
+        {
+            return Append(csq, 0, csq.Length);
+        }
+
+        // LUCENENET specific - overload for string (more common in .NET than ICharSequence)
+        public virtual OpenStringBuilder Append(string csq, int start, int end)
+        {
+            Reserve(end - start);
+            for (int i = start; i < end; i++)
+            {
+                UnsafeWrite(csq[i]);
+            }
+            return this;
+        }
+
+        // LUCENENET specific - overload for StringBuilder
+        public virtual OpenStringBuilder Append(StringBuilder csq)
+        {
+            return Append(csq, 0, csq.Length);
+        }
+
+        // LUCENENET specific - overload for StringBuilder
+        public virtual OpenStringBuilder Append(StringBuilder csq, int start, int end)
         {
             Reserve(end - start);
             for (int i = start; i < end; i++)


Mime
View raw message