lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [1/3] lucenenet git commit: Added Sort and BinarySearch methods
Date Thu, 28 Jan 2016 10:42:26 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master 4dcbcd1ad -> c6d7bec47


Added Sort and BinarySearch methods

These methods are used in some of the collectors in Java Lucene 4.8 and will be needed.

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

Branch: refs/heads/master
Commit: 5efaf750b585f553087ef979aeb08e3a599204c2
Parents: 4dcbcd1
Author: WakeflyCBass <cbass@wakefly.com>
Authored: Wed Jan 27 11:43:35 2016 -0500
Committer: WakeflyCBass <cbass@wakefly.com>
Committed: Wed Jan 27 11:43:35 2016 -0500

----------------------------------------------------------------------
 src/Lucene.Net.Core/Support/Arrays.cs | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5efaf750/src/Lucene.Net.Core/Support/Arrays.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/Arrays.cs b/src/Lucene.Net.Core/Support/Arrays.cs
index 578e1f7..e569b8a 100644
--- a/src/Lucene.Net.Core/Support/Arrays.cs
+++ b/src/Lucene.Net.Core/Support/Arrays.cs
@@ -59,6 +59,19 @@ namespace Lucene.Net.Support
 
             return true;
         }
+        
+        public static T[] Sort<T>(T[] original)
+		{
+			T[] newArray = new T[original.Length];
+			Array.Copy(original, newArray, original.Length);
+			Sort<T>(newArray);
+			return newArray;
+		}
+
+		public static int BinarySearch<T>(T[] list, T item)
+		{
+			return Array.BinarySearch<T>(list, item);
+		}
 
         public static T[] CopyOf<T>(T[] original, int newLength)
         {
@@ -129,4 +142,4 @@ namespace Lucene.Net.Support
             return objects.ToList();
         }
     }
-}
\ No newline at end of file
+}


Mime
View raw message