Return-Path: X-Original-To: apmail-accumulo-notifications-archive@minotaur.apache.org Delivered-To: apmail-accumulo-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7E0ED10C8E for ; Fri, 27 Sep 2013 20:03:08 +0000 (UTC) Received: (qmail 4287 invoked by uid 500); 27 Sep 2013 20:03:07 -0000 Delivered-To: apmail-accumulo-notifications-archive@accumulo.apache.org Received: (qmail 4171 invoked by uid 500); 27 Sep 2013 20:03:07 -0000 Mailing-List: contact notifications-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jira@apache.org Delivered-To: mailing list notifications@accumulo.apache.org Received: (qmail 3874 invoked by uid 99); 27 Sep 2013 20:03:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Sep 2013 20:03:04 +0000 Date: Fri, 27 Sep 2013 20:03:04 +0000 (UTC) From: "Keith Turner (JIRA)" To: notifications@accumulo.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ACCUMULO-1627) Add hashcode() and equals() to ConditionalMutation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/ACCUMULO-1627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13780316#comment-13780316 ] Keith Turner commented on ACCUMULO-1627: ---------------------------------------- I experimented w/ the concept of moving the code thats in equals(Mutation) to equals(Object), and forcing equals(Mutation) to call equals(Object). {code:java} class Mutation { int r; public Mutation(int r) { this.r = r; } public boolean equals(Mutation m) { return equals((Object) m); } public boolean equals(Object o) { if (o instanceof Mutation) { return r == ((Mutation) o).r; } return false; } } class CondMutation extends Mutation { int cond; public CondMutation(int r, int c) { super(r); this.cond = c; } public boolean equals(Object o) { if (o instanceof CondMutation) { if (super.equals(o)) { CondMutation cm = (CondMutation) o; return cond == cm.cond; } } return false; } } {code} With this change the following code will call Mutation.equals(Mutation) which calls ConditionalMutation.equals(Object). Have to be careful when implementing ConditionalMutation.equals(Object) because if it calls Mutation.equals(Mutation) then could have an infinite loop. {code:java} ConditionalMutation cm1 = new ConditionalMutation(1,2); ConditionalMutation cm2 = new ConditionalMutation(3,2); cm1.equals(cm2); {code} > Add hashcode() and equals() to ConditionalMutation > -------------------------------------------------- > > Key: ACCUMULO-1627 > URL: https://issues.apache.org/jira/browse/ACCUMULO-1627 > Project: Accumulo > Issue Type: Sub-task > Components: client, tserver > Reporter: Keith Turner > Assignee: Bill Havanki > Labels: newbie > Fix For: 1.6.0 > > > ConditionalMutation should define equals() and hashcode() methods that consider the conditions. Its parent class defines those methods, so it should. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira