directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r327943 - /directory/protocol-providers/dns/trunk/src/java/org/apache/dns/messages/ResourceRecordImpl.java
Date Mon, 24 Oct 2005 03:32:50 GMT
Author: erodriguez
Date: Sun Oct 23 20:32:47 2005
New Revision: 327943

URL: http://svn.apache.org/viewcvs?rev=327943&view=rev
Log:
Implemented equals and hashCode for use in Collections.

Modified:
    directory/protocol-providers/dns/trunk/src/java/org/apache/dns/messages/ResourceRecordImpl.java

Modified: directory/protocol-providers/dns/trunk/src/java/org/apache/dns/messages/ResourceRecordImpl.java
URL: http://svn.apache.org/viewcvs/directory/protocol-providers/dns/trunk/src/java/org/apache/dns/messages/ResourceRecordImpl.java?rev=327943&r1=327942&r2=327943&view=diff
==============================================================================
--- directory/protocol-providers/dns/trunk/src/java/org/apache/dns/messages/ResourceRecordImpl.java
(original)
+++ directory/protocol-providers/dns/trunk/src/java/org/apache/dns/messages/ResourceRecordImpl.java
Sun Oct 23 20:32:47 2005
@@ -133,6 +133,29 @@
         return (String) attributes.get( id );
     }
 
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+
+        if ( !( o instanceof ResourceRecord ) )
+        {
+            return false;
+        }
+
+        ResourceRecordImpl that = (ResourceRecordImpl) o;
+
+        return ( this.domainName.equals( that.domainName ) ) && ( this.recordType
== that.recordType )
+                && ( this.recordClass == that.recordClass );
+    }
+
+    public int hashCode()
+    {
+        return domainName.hashCode() + recordType.hashCode() + recordClass.hashCode();
+    }
+
     public String toString()
     {
         return getClass().getName() + " [ " + domainName + " ( " + recordType + " " + recordClass
+ " " + timeToLive



Mime
View raw message