directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1079700 - in /directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls: PagedResultsImpl.java SubentriesImpl.java
Date Wed, 09 Mar 2011 08:41:49 GMT
Author: pamarcelot
Date: Wed Mar  9 08:41:48 2011
New Revision: 1079700

URL: http://svn.apache.org/viewvc?rev=1079700&view=rev
Log:
Added hashCode() method.

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PagedResultsImpl.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SubentriesImpl.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PagedResultsImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PagedResultsImpl.java?rev=1079700&r1=1079699&r2=1079700&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PagedResultsImpl.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PagedResultsImpl.java
Wed Mar  9 08:41:48 2011
@@ -59,7 +59,6 @@ import java.util.Arrays;
  */
 public class PagedResultsImpl extends AbstractControl implements PagedResults
 {
-
     /** The number of entries to return, or returned */
     private int size;
 
@@ -130,6 +129,28 @@ public class PagedResultsImpl extends Ab
 
 
     /**
+     * @see Object#hashCode()
+     */
+    @Override
+    public int hashCode()
+    {
+        int h = super.hashCode();
+
+        h = h * 37 + size;
+
+        if ( cookie != null )
+        {
+            for ( byte b : cookie )
+            {
+                h = h * 17 + b;
+            }
+        }
+
+        return h;
+    }
+
+
+    /**
      * @see Object#equals(Object)
      */
     @Override
@@ -157,7 +178,7 @@ public class PagedResultsImpl extends Ab
         sb.append( "        oid : " ).append( getOid() ).append( '\n' );
         sb.append( "        critical : " ).append( isCritical() ).append( '\n' );
         sb.append( "        size   : '" ).append( size ).append( "'\n" );
-        sb.append( "        cookie   : '" ).append( Strings.dumpBytes(cookie) ).append( "'\n"
);
+        sb.append( "        cookie   : '" ).append( Strings.dumpBytes( cookie ) ).append(
"'\n" );
 
         return sb.toString();
     }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SubentriesImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SubentriesImpl.java?rev=1079700&r1=1079699&r2=1079700&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SubentriesImpl.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SubentriesImpl.java
Wed Mar  9 08:41:48 2011
@@ -87,6 +87,20 @@ public class SubentriesImpl extends Abst
 
 
     /**
+     * @see Object#hashCode()
+     */
+    @Override
+    public int hashCode()
+    {
+        int h = super.hashCode();
+
+        h = h * 37 + ( visibility ? 1 : 0 );
+
+        return h;
+    }
+
+
+    /**
      * @see Object#equals(Object)
      */
     public boolean equals( Object o )



Mime
View raw message