Return-Path: Delivered-To: apmail-jakarta-avalon-cvs-archive@apache.org Received: (qmail 81818 invoked from network); 23 Sep 2002 21:05:43 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 23 Sep 2002 21:05:43 -0000 Received: (qmail 22635 invoked by uid 97); 23 Sep 2002 21:06:22 -0000 Delivered-To: qmlist-jakarta-archive-avalon-cvs@jakarta.apache.org Received: (qmail 22495 invoked by uid 97); 23 Sep 2002 21:06:21 -0000 Mailing-List: contact avalon-cvs-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon CVS List" Reply-To: "Avalon Developers List" Delivered-To: mailing list avalon-cvs@jakarta.apache.org Received: (qmail 22344 invoked by uid 97); 23 Sep 2002 21:06:20 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: 23 Sep 2002 21:05:29 -0000 Message-ID: <20020923210529.75840.qmail@icarus.apache.org> From: bloritsch@apache.org To: jakarta-avalon-excalibur-cvs@apache.org Subject: cvs commit: jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info ReferenceDescriptor.java ServiceDefinition.java ServiceDescriptor.java StageDescriptor.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N bloritsch 2002/09/23 14:05:29 Modified: meta/src/java/org/apache/excalibur/meta/info ReferenceDescriptor.java ServiceDefinition.java ServiceDescriptor.java StageDescriptor.java Log: add methods to make the descriptors more friendly with hashmaps Revision Changes Path 1.3 +32 -1 jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/ReferenceDescriptor.java Index: ReferenceDescriptor.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/ReferenceDescriptor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ReferenceDescriptor.java 21 Aug 2002 03:34:32 -0000 1.2 +++ ReferenceDescriptor.java 23 Sep 2002 21:05:29 -0000 1.3 @@ -111,4 +111,35 @@ { return getClassname() + "/" + getVersion(); } + + /** + * Make the ReferenceDescriptor friendly with Hashmaps. + */ + public int hashCode() + { + return getClassname().hashCode() + getVersion().hashCode(); + } + + /** + * Make the ReferenceDescriptor friendly with Hashmaps. + */ + public boolean equals(Object other) + { + boolean match = false; + + if ( other instanceof ReferenceDescriptor ) + { + match = ( (ReferenceDescriptor) other).matches( this ); + } + else if ( other instanceof ServiceDefinition ) + { + match = ( (ServiceDefinition) other).matches( this ); + } + else if ( other instanceof ServiceDescriptor ) + { + match = ( (ServiceDefinition) other).matches( this ); + } + + return match; + } } 1.2 +35 -6 jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/ServiceDefinition.java Index: ServiceDefinition.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/ServiceDefinition.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ServiceDefinition.java 22 Sep 2002 07:54:20 -0000 1.1 +++ ServiceDefinition.java 23 Sep 2002 21:05:29 -0000 1.2 @@ -56,7 +56,7 @@ } /** - * Creation of a new ServiceDefinition instance using a classname and + * Creation of a new ServiceDefinition instance using a classname and * supplied properties argument. * * @param classname the classname of the service @@ -69,16 +69,16 @@ } /** - * Creation of a new ServiceDefinition instance using a classname and + * Creation of a new ServiceDefinition instance using a classname and * supplied properties argument. * * @param classname the classname of the service * @param version the service version * @param attributes the set of attributes to assign to the descriptor */ - public ServiceDefinition( - final String classname, - final Version version, + public ServiceDefinition( + final String classname, + final Version version, final Properties attributes ) { super( attributes ); @@ -128,5 +128,34 @@ return reference.getClassname().equals( getClassname() ) && reference.getVersion().complies( getVersion() ); + } + + /** + * Make the ServiceDefinition friendly with Hashmaps. + */ + public int hashCode() + { + return getClassname().hashCode() + getVersion().hashCode(); + } + + /** + * Make the ServiceDefinition friendly with Hashmaps. + */ + public boolean equals( Object other ) + { + boolean match = false; + + if ( other instanceof ReferenceDescriptor ) + { + match = matches( (ReferenceDescriptor) other ); + } + else if ( other instanceof ServiceDefinition ) + { + ServiceDefinition ref = (ServiceDefinition) other; + match = ref.getClassname().equals( getClassname() ) && + ref.getVersion().complies( getVersion() ); + } + + return match; } } 1.4 +9 -2 jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/ServiceDescriptor.java Index: ServiceDescriptor.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/ServiceDescriptor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ServiceDescriptor.java 13 Sep 2002 20:31:22 -0000 1.3 +++ ServiceDescriptor.java 23 Sep 2002 21:05:29 -0000 1.4 @@ -43,7 +43,7 @@ /** * Construct a service descriptor for specified ReferenceDescriptor * - * @param designator the service reference + * @param designator the service reference * @exception NullPointerException if the designator argument is null */ public ServiceDescriptor( final ReferenceDescriptor designator ) @@ -94,4 +94,11 @@ return m_designator; } + /** + * Make the ReferenceDescriptor friendly with Hashmaps. + */ + public int hashCode() + { + return getReference().hashCode(); + } } 1.2 +8 -1 jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/StageDescriptor.java Index: StageDescriptor.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/meta/src/java/org/apache/excalibur/meta/info/StageDescriptor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- StageDescriptor.java 22 Aug 2002 13:55:31 -0000 1.1 +++ StageDescriptor.java 23 Sep 2002 21:05:29 -0000 1.2 @@ -63,4 +63,11 @@ return m_reference; } + /** + * Make the ReferenceDescriptor friendly with Hashmaps. + */ + public int hashCode() + { + return getReference().hashCode(); + } } -- To unsubscribe, e-mail: For additional commands, e-mail: