Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DC0DF200BBB for ; Thu, 10 Nov 2016 12:33:17 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id DA9EF160B1B; Thu, 10 Nov 2016 11:33:17 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B7C2F160B1E for ; Thu, 10 Nov 2016 12:33:16 +0100 (CET) Received: (qmail 64679 invoked by uid 500); 10 Nov 2016 11:33:14 -0000 Mailing-List: contact commits-help@lucenenet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-dev@lucenenet.apache.org Delivered-To: mailing list commits@lucenenet.apache.org Received: (qmail 63323 invoked by uid 99); 10 Nov 2016 11:33:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Nov 2016 11:33:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DA1BCED30E; Thu, 10 Nov 2016 11:33:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: nightowl888@apache.org To: commits@lucenenet.apache.org Date: Thu, 10 Nov 2016 11:33:52 -0000 Message-Id: <62b01eb6125f4010a35e454015e23f32@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [41/58] [abbrv] lucenenet git commit: Implemented IComparable in Core.Util.Mutable.MutableValue, IComparable does not automatically bring it along. archived-at: Thu, 10 Nov 2016 11:33:18 -0000 Implemented IComparable in Core.Util.Mutable.MutableValue, IComparable does not automatically bring it along. Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/fa5f4404 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/fa5f4404 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/fa5f4404 Branch: refs/heads/grouping Commit: fa5f44047ccf406b17dd49530009007de0367462 Parents: f08a0e8 Author: Shad Storhaug Authored: Sat Nov 5 20:37:29 2016 +0700 Committer: Shad Storhaug Committed: Tue Nov 8 02:24:56 2016 +0700 ---------------------------------------------------------------------- .../Util/Mutable/MutableValue.cs | 26 +++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/fa5f4404/src/Lucene.Net.Core/Util/Mutable/MutableValue.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Mutable/MutableValue.cs b/src/Lucene.Net.Core/Util/Mutable/MutableValue.cs index 66334b3..d4f5154 100644 --- a/src/Lucene.Net.Core/Util/Mutable/MutableValue.cs +++ b/src/Lucene.Net.Core/Util/Mutable/MutableValue.cs @@ -1,3 +1,4 @@ +using Lucene.Net.Support; using System; /* @@ -24,7 +25,7 @@ namespace Lucene.Net.Util.Mutable /// /// @lucene.internal /// - public abstract class MutableValue : IComparable + public abstract class MutableValue : IComparable, IComparable { protected MutableValue() { @@ -52,8 +53,27 @@ namespace Lucene.Net.Util.Mutable int c = c1.GetHashCode() - c2.GetHashCode(); if (c == 0) { - //c = c1.CanonicalName.CompareTo(c2.CanonicalName); - c = String.Compare(c1.Name, c2.Name, StringComparison.Ordinal); + c = c1.FullName.CompareToOrdinal(c2.FullName); + } + return c; + } + return CompareSameType(other); + } + + + // LUCENENET specific implementation, for use with FunctionFirstPassGroupingCollector + // (note that IComparable does not inherit IComparable, so we need to explicitly + // do that here in order to support IComparable) + public int CompareTo(object other) + { + Type c1 = this.GetType(); + Type c2 = other.GetType(); + if (c1 != c2) + { + int c = c1.GetHashCode() - c2.GetHashCode(); + if (c == 0) + { + c = c1.FullName.CompareToOrdinal(c2.FullName); } return c; }