summaryrefslogtreecommitdiff
path: root/org
diff options
context:
space:
mode:
authorAudrius Meskauskas <audriusa@Bioinformatics.org>2005-09-14 19:48:02 +0000
committerAudrius Meskauskas <audriusa@Bioinformatics.org>2005-09-14 19:48:02 +0000
commit9db897cc0e40693a6939eed8bb1dec03c813beee (patch)
treec6218aa03e0c5e05a7ba1face122472cb7d9ef4a /org
parent692e07d35673d3f7fef57901b38722dc2491bc0c (diff)
downloadclasspath-9db897cc0e40693a6939eed8bb1dec03c813beee.tar.gz
2005-09-14 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CosNaming/NameComponent (hashCode): New method.
Diffstat (limited to 'org')
-rw-r--r--org/omg/CosNaming/NameComponent.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/org/omg/CosNaming/NameComponent.java b/org/omg/CosNaming/NameComponent.java
index a2db313e6..1e06caaef 100644
--- a/org/omg/CosNaming/NameComponent.java
+++ b/org/omg/CosNaming/NameComponent.java
@@ -40,6 +40,8 @@ package org.omg.CosNaming;
import org.omg.CORBA.portable.IDLEntity;
+import java.util.zip.Adler32;
+
/**
* The name component, a node in the multi-comonent name.
*
@@ -115,4 +117,14 @@ public final class NameComponent
{
return id + "." + kind;
}
-} \ No newline at end of file
+
+ /**
+ * Return the hashCode of this NameComponent.
+ */
+ public int hashCode()
+ {
+ Adler32 adler = new Adler32();
+ adler.update(toString().getBytes());
+ return (int) adler.getValue() & Integer.MAX_VALUE;
+ }
+}