Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 63B1967AF for ; Thu, 16 Jun 2011 18:54:43 +0000 (UTC) Received: (qmail 27300 invoked by uid 500); 16 Jun 2011 18:54:43 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 27248 invoked by uid 500); 16 Jun 2011 18:54:43 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 27241 invoked by uid 99); 16 Jun 2011 18:54:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jun 2011 18:54:43 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jun 2011 18:54:40 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EE9F623889F7; Thu, 16 Jun 2011 18:54:19 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1136599 - /commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledVertex.java Date: Thu, 16 Jun 2011 18:54:19 -0000 To: commits@commons.apache.org From: simonetripodi@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110616185419.EE9F623889F7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: simonetripodi Date: Thu Jun 16 18:54:19 2011 New Revision: 1136599 URL: http://svn.apache.org/viewvc?rev=1136599&view=rev Log: implemented equals/hashCode methods Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledVertex.java Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledVertex.java URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledVertex.java?rev=1136599&r1=1136598&r2=1136599&view=diff ============================================================================== --- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledVertex.java (original) +++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledVertex.java Thu Jun 16 18:54:19 2011 @@ -46,6 +46,55 @@ public class BaseLabeledVertex * {@inheritDoc} */ @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + ( ( label == null ) ? 0 : label.hashCode() ); + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals( Object obj ) + { + if ( this == obj ) + { + return true; + } + + if ( obj == null ) + { + return false; + } + + if ( getClass() != obj.getClass() ) + { + return false; + } + + BaseLabeledVertex other = (BaseLabeledVertex) obj; + if ( label == null ) + { + if ( other.getLabel() != null ) + { + return false; + } + } + else if ( !label.equals( other.getLabel() ) ) + { + return false; + } + + return true; + } + + /** + * {@inheritDoc} + */ + @Override public String toString() { return format( "Vertex(label=%s)", label );