Return-Path: X-Original-To: apmail-ctakes-commits-archive@www.apache.org Delivered-To: apmail-ctakes-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AD64E18A48 for ; Fri, 18 Mar 2016 20:36:45 +0000 (UTC) Received: (qmail 15114 invoked by uid 500); 18 Mar 2016 20:36:45 -0000 Delivered-To: apmail-ctakes-commits-archive@ctakes.apache.org Received: (qmail 15077 invoked by uid 500); 18 Mar 2016 20:36:45 -0000 Mailing-List: contact commits-help@ctakes.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ctakes.apache.org Delivered-To: mailing list commits@ctakes.apache.org Received: (qmail 15068 invoked by uid 99); 18 Mar 2016 20:36:45 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Mar 2016 20:36:45 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 07679C23BE for ; Fri, 18 Mar 2016 20:36:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.999 X-Spam-Level: X-Spam-Status: No, score=0.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id nHuzsZfQXooc for ; Fri, 18 Mar 2016 20:36:44 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTP id 667D55F47A for ; Fri, 18 Mar 2016 20:36:43 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 70634E013F for ; Fri, 18 Mar 2016 20:36:42 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 6DBF73A022C for ; Fri, 18 Mar 2016 20:36:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1735676 - /ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java Date: Fri, 18 Mar 2016 20:36:42 -0000 To: commits@ctakes.apache.org From: clin@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160318203642.6DBF73A022C@svn01-us-west.apache.org> Author: clin Date: Fri Mar 18 20:36:42 2016 New Revision: 1735676 URL: http://svn.apache.org/viewvc?rev=1735676&view=rev Log: modify the equals() and hashCode() so that sorting will not violate hashcode contract for event-time relation evaluation. Modified: ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java Modified: ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java?rev=1735676&r1=1735675&r2=1735676&view=diff ============================================================================== --- ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java (original) +++ ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/eval/RelationExtractorEvaluation.java Fri Mar 18 20:36:42 2016 @@ -767,21 +767,67 @@ public class RelationExtractorEvaluation @Override public boolean equals(Object otherObject) { + int preArgBegin; + int preArgEnd; + int ltrArgBegin; + int ltrArgEnd; + if(this.arg1begin< this.arg2begin){ + preArgBegin = this.arg1begin; + preArgEnd = this.arg1end; + ltrArgBegin = this.arg2begin; + ltrArgEnd = this.arg2end; + }else{ + preArgBegin = this.arg2begin; + preArgEnd = this.arg2end; + ltrArgBegin = this.arg1begin; + ltrArgEnd = this.arg1end; + } boolean result = false; if (otherObject instanceof HashableArguments) { HashableArguments other = (HashableArguments) otherObject; + int otherPreArgBegin; + int otherPreArgEnd; + int otherLtrArgBegin; + int otherLtrArgEnd; + if(other.arg1begin< other.arg2begin){ + otherPreArgBegin = other.arg1begin; + otherPreArgEnd = other.arg1end; + otherLtrArgBegin = other.arg2begin; + otherLtrArgEnd = other.arg2end; + }else{ + otherPreArgBegin = other.arg2begin; + otherPreArgEnd = other.arg2end; + otherLtrArgBegin = other.arg1begin; + otherLtrArgEnd = other.arg1end; + } result = (this.getClass() == other.getClass() - && this.arg1begin == other.arg1begin - && this.arg1end == other.arg1end - && this.arg2begin == other.arg2begin && this.arg2end == other.arg2end); + && preArgBegin == otherPreArgBegin + && preArgEnd == otherPreArgEnd + && ltrArgBegin == otherLtrArgBegin + && ltrArgEnd == otherLtrArgEnd); } return result; } @Override public int hashCode() { - return Objects.hashCode(this.arg1begin, this.arg1end, this.arg2begin, this.arg2end); + int preArgBegin; + int preArgEnd; + int ltrArgBegin; + int ltrArgEnd; + if(this.arg1begin< this.arg2begin){ + preArgBegin = this.arg1begin; + preArgEnd = this.arg1end; + ltrArgBegin = this.arg2begin; + ltrArgEnd = this.arg2end; + }else{ + preArgBegin = this.arg2begin; + preArgEnd = this.arg2end; + ltrArgBegin = this.arg1begin; + ltrArgEnd = this.arg1end; + } + return Objects.hashCode(preArgBegin, preArgEnd, ltrArgBegin, ltrArgEnd); } @Override