directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1039475 - in /directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components: AuthorizationData.java TransitedEncoding.java
Date Fri, 26 Nov 2010 17:36:31 GMT
Author: kayyagari
Date: Fri Nov 26 17:36:31 2010
New Revision: 1039475

URL: http://svn.apache.org/viewvc?rev=1039475&view=rev
Log:
o added hashCode and equals methods

Modified:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/TransitedEncoding.java

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java?rev=1039475&r1=1039474&r2=1039475&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/AuthorizationData.java
Fri Nov 26 17:36:31 2010
@@ -24,6 +24,7 @@ package org.apache.directory.shared.kerb
 import java.nio.BufferOverflowException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.apache.directory.server.i18n.I18n;
@@ -76,6 +77,58 @@ public class AuthorizationData extends A
         {
             return adData;
         }
+        
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public int hashCode()
+        {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + getOuterType().hashCode();
+            result = prime * result + Arrays.hashCode( adData );
+            result = prime * result + ( ( adType == null ) ? 0 : adType.hashCode() );
+            return result;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean equals( Object obj )
+        {
+            if ( this == obj )
+            {
+                return true;
+            }
+            
+            if ( obj == null )
+            {
+                return false;
+            }
+            
+            AD other = ( AD ) obj;
+            
+            if ( !Arrays.equals( adData, other.adData ) )
+            {
+                return false;
+            }
+            
+            if ( adType != other.adType )
+            {
+                return false;
+            }
+
+            return true;
+        }
+
+        private AuthorizationData getOuterType()
+        {
+            return AuthorizationData.this;
+        }
+        
     }
     
     /** The list of AuthorizationData elements */
@@ -276,6 +329,61 @@ public class AuthorizationData extends A
     
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ( ( authorizationData == null ) ? 0 : authorizationData.hashCode()
);
+        result = prime * result + ( ( currentAD == null ) ? 0 : currentAD.hashCode() );
+        return result;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals( Object obj )
+    {
+        if ( obj == null )
+        {
+            return false;
+        }
+        
+        AuthorizationData other = ( AuthorizationData ) obj;
+        
+        if ( authorizationData == null )
+        {
+            if ( other.authorizationData != null )
+            {
+                return false;
+            }
+        }
+        else if ( !authorizationData.equals( other.authorizationData ) )
+        {
+            return false;
+        }
+        
+        if ( currentAD == null )
+        {
+            if ( other.currentAD != null )
+            {
+                return false;
+            }
+        }
+        else if ( !currentAD.equals( other.currentAD ) )
+        {
+            return false;
+        }
+        
+        return true;
+    }
+
+
+    /**
      * @see Object#toString()
      */
     public String toString( String tabs )

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/TransitedEncoding.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/TransitedEncoding.java?rev=1039475&r1=1039474&r2=1039475&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/TransitedEncoding.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/TransitedEncoding.java
Fri Nov 26 17:36:31 2010
@@ -22,6 +22,7 @@ package org.apache.directory.shared.kerb
 
 import java.nio.BufferOverflowException;
 import java.nio.ByteBuffer;
+import java.util.Arrays;
 
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.asn1.AbstractAsn1Object;
@@ -229,6 +230,52 @@ public class TransitedEncoding extends A
 
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + Arrays.hashCode( contents );
+        result = prime * result + ( ( trType == null ) ? 0 : trType.hashCode() );
+        return result;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+        
+        if ( obj == null )
+        {
+            return false;
+        }
+        
+        TransitedEncoding other = ( TransitedEncoding ) obj;
+        
+        if ( !Arrays.equals( contents, other.contents ) )
+        {
+            return false;
+        }
+        
+        if ( trType != other.trType )
+        {
+            return false;
+        }
+        
+        return true;
+    }
+
+
+    /**
      * @see Object#toString()
      */
     public String toString()



Mime
View raw message