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/01/31 17:55:36 UTC
[03/50] [abbrv] lucenenet git commit: Lucene.Net.Core.Util (ArrayUtil
+ CollectionUtil): Removed generic constraints from TimSort and IntroSort
because they are not necessary to use the natural comparer
(Comparer.Default) in .NET.
Lucene.Net.Core.Util (ArrayUtil + CollectionUtil): Removed generic constraints from TimSort and IntroSort because they are not necessary to use the natural comparer (Comparer<T>.Default) in .NET.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/e9f97524
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/e9f97524
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/e9f97524
Branch: refs/heads/api-work
Commit: e9f975245caba284b1bd4091bc1f8c2075d14bb6
Parents: 33d2afc
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Jan 31 11:09:54 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Jan 31 11:19:01 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Util/ArrayUtil.cs | 10 +++++-----
src/Lucene.Net.Core/Util/CollectionUtil.cs | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e9f97524/src/Lucene.Net.Core/Util/ArrayUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/ArrayUtil.cs b/src/Lucene.Net.Core/Util/ArrayUtil.cs
index 0dab74e..1ca217c 100644
--- a/src/Lucene.Net.Core/Util/ArrayUtil.cs
+++ b/src/Lucene.Net.Core/Util/ArrayUtil.cs
@@ -781,7 +781,7 @@ namespace Lucene.Net.Util
/// <summary>
/// Get the natural <seealso cref="Comparer"/> for the provided object class. </summary>
public static IComparer<T> NaturalComparer<T>()
- where T : IComparable<T>
+ //where T : IComparable<T> // LUCENENET specific: removing constraint because in .NET, it is not needed
{
return Comparer<T>.Default;
//return (IComparer<T>)new NaturalComparerImpl<T>();
@@ -826,7 +826,7 @@ namespace Lucene.Net.Util
/// algorithm, but falls back to insertion sort for small arrays. </summary>
/// <param name="fromIndex"> start index (inclusive) </param>
/// <param name="toIndex"> end index (exclusive) </param>
- public static void IntroSort<T>(T[] a, int fromIndex, int toIndex) where T : IComparable<T>
+ public static void IntroSort<T>(T[] a, int fromIndex, int toIndex) //where T : IComparable<T> // LUCENENET specific: removing constraint because in .NET, it is not needed
{
if (toIndex - fromIndex <= 1)
{
@@ -839,7 +839,7 @@ namespace Lucene.Net.Util
/// Sorts the given array in natural order. this method uses the intro sort
/// algorithm, but falls back to insertion sort for small arrays.
/// </summary>
- public static void IntroSort<T>(T[] a) where T : IComparable<T>
+ public static void IntroSort<T>(T[] a) //where T : IComparable<T> // LUCENENET specific: removing constraint because in .NET, it is not needed
{
IntroSort(a, 0, a.Length);
}
@@ -874,7 +874,7 @@ namespace Lucene.Net.Util
/// algorithm, but falls back to binary sort for small arrays. </summary>
/// <param name="fromIndex"> start index (inclusive) </param>
/// <param name="toIndex"> end index (exclusive) </param>
- public static void TimSort<T>(T[] a, int fromIndex, int toIndex) where T : IComparable<T>
+ public static void TimSort<T>(T[] a, int fromIndex, int toIndex) //where T : IComparable<T> // LUCENENET specific: removing constraint because in .NET, it is not needed
{
if (toIndex - fromIndex <= 1)
{
@@ -887,7 +887,7 @@ namespace Lucene.Net.Util
/// Sorts the given array in natural order. this method uses the Tim sort
/// algorithm, but falls back to binary sort for small arrays.
/// </summary>
- public static void TimSort<T>(T[] a) where T : IComparable<T>
+ public static void TimSort<T>(T[] a) //where T : IComparable<T> // LUCENENET specific: removing constraint because in .NET, it is not needed
{
TimSort(a, 0, a.Length);
}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e9f97524/src/Lucene.Net.Core/Util/CollectionUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/CollectionUtil.cs b/src/Lucene.Net.Core/Util/CollectionUtil.cs
index 6025f28..5105af6 100644
--- a/src/Lucene.Net.Core/Util/CollectionUtil.cs
+++ b/src/Lucene.Net.Core/Util/CollectionUtil.cs
@@ -155,7 +155,7 @@ namespace Lucene.Net.Util
/// algorithm, but falls back to insertion sort for small lists. </summary>
/// <exception cref="IllegalArgumentException"> if list is e.g. a linked list without random access. </exception>
public static void IntroSort<T>(IList<T> list)
- where T : IComparable<T>
+ //where T : IComparable<T> // LUCENENET specific: removing constraint because in .NET, it is not needed
{
int size = list.Count;
if (size <= 1)
@@ -188,7 +188,7 @@ namespace Lucene.Net.Util
/// algorithm, but falls back to binary sort for small lists. </summary>
/// <exception cref="IllegalArgumentException"> if list is e.g. a linked list without random access. </exception>
public static void TimSort<T>(IList<T> list)
- where T : IComparable<T>
+ //where T : IComparable<T> // LUCENENET specific: removing constraint because in .NET, it is not needed
{
int size = list.Count;
if (size <= 1)