Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 88156 invoked from network); 17 Jan 2002 18:23:01 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 17 Jan 2002 18:23:01 -0000 Received: (qmail 27077 invoked by uid 97); 17 Jan 2002 18:22:41 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 27060 invoked by uid 97); 17 Jan 2002 18:22:40 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 822 invoked from network); 17 Jan 2002 17:23:56 -0000 X-Originating-IP: [24.162.232.172] From: "Marc Johnson" To: commons-dev@jakarta.apache.org Bcc: Subject: [NEW CLASS -- NOTHING TO PATCH]: LocalTestNode.java Date: Thu, 17 Jan 2002 17:23:56 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 17 Jan 2002 17:23:56.0247 (UTC) FILETIME=[BE1D4E70:01C19F7B] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE file. */ package org.apache.commons.collections; /** * Class LocalTestNode * * a helper class for TestDoubleOrderedMap * * @author Marc Johnson (marcj at users dot sourceforge dot net) */ class LocalTestNode implements Comparable { private Comparable key; private Comparable value; /** * construct a LocalTestNode * * @param key value used to create the key and value */ LocalTestNode(final int key) { this.key = new Integer(key); this.value = String.valueOf(key); } /** * @param key the unique key associated with the current node. */ void setKey(Comparable key) { this.key = key; } /** * @return the unique key associated with the current node */ Comparable getKey() { return key; } /** * @param value the unique value associated with the current node. */ void setValue(Comparable value) { this.value = value; } /** * @return the unique value associated with the current node */ Comparable getValue() { return value; } /** * Method compareTo * * @param o * * @return */ public int compareTo(Object o) { LocalTestNode other = (LocalTestNode) o; int rval = getKey().compareTo(other.getKey()); if (rval == 0) { rval = getValue().compareTo(other.getValue()); } return rval; } /** * Method equals * * @param o * * @return true if equal */ public boolean equals(Object o) { if (o == null) { return false; } if (!(o.getClass().equals(this.getClass()))) { return false; } LocalTestNode node = (LocalTestNode) o; return (getKey().equals(node.getKey()) && getValue().equals(node.getValue())); } /** * @return hash code */ public int hashCode() { return getKey().hashCode() ^ getValue().hashCode(); } } _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: For additional commands, e-mail: