directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1039055 - in /directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos: KerberosTime.java components/PrincipalName.java flags/AbstractKerberosFlags.java
Date Thu, 25 Nov 2010 14:21:15 GMT
Author: kayyagari
Date: Thu Nov 25 14:21:15 2010
New Revision: 1039055

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

Modified:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/KerberosTime.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/PrincipalName.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/flags/AbstractKerberosFlags.java

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/KerberosTime.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/KerberosTime.java?rev=1039055&r1=1039054&r2=1039055&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/KerberosTime.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/KerberosTime.java
Thu Nov 25 14:21:15 2010
@@ -144,4 +144,45 @@ public class KerberosTime
     {
         return date;
     }
+
+
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ( ( date == null ) ? 0 : date.hashCode() );
+        return result;
+    }
+
+
+    @Override
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+        
+        if ( obj == null )
+        {
+            return true;
+        }
+        
+        KerberosTime other = ( KerberosTime ) obj;
+        
+        if ( date == null )
+        {
+            if ( other.date != null )
+            {
+                return false;
+            }
+        }
+        else if ( !date.equals( other.date ) )
+        {
+            return false;
+        }
+        
+        return true;
+    }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/PrincipalName.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/PrincipalName.java?rev=1039055&r1=1039054&r2=1039055&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/PrincipalName.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/PrincipalName.java
Thu Nov 25 14:21:15 2010
@@ -476,4 +476,52 @@ public class PrincipalName extends Abstr
 
         return sb.toString();
     }
+
+
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ( ( nameString == null ) ? 0 : nameString.hashCode() );
+        result = prime * result + ( ( nameType == null ) ? 0 : nameType.hashCode() );
+        return result;
+    }
+
+
+    @Override
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+        
+        if ( obj == null )
+        {
+            return false;
+        }
+        
+        PrincipalName other = ( PrincipalName ) obj;
+
+        if ( nameString == null )
+        {
+            if ( other.nameString != null )
+            {
+                return false;
+            }
+        }
+        else if ( !nameString.equals( other.nameString ) )
+        {
+            return false;
+        }
+
+        if ( nameType != other.nameType )
+        {
+            return false;
+        }
+        
+        return true;
+    }
+    
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/flags/AbstractKerberosFlags.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/flags/AbstractKerberosFlags.java?rev=1039055&r1=1039054&r2=1039055&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/flags/AbstractKerberosFlags.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/flags/AbstractKerberosFlags.java
Thu Nov 25 14:21:15 2010
@@ -196,4 +196,38 @@ public abstract class AbstractKerberosFl
         clearBit( flag );
         value &= ~( 1 << pos );
     }
+
+
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + value;
+        return result;
+    }
+
+    
+    @Override
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+        
+        if ( obj == null )
+        {
+            return false;
+        }
+        
+        AbstractKerberosFlags other = ( AbstractKerberosFlags ) obj;
+        
+        if ( value != other.value )
+        {
+            return false;
+        }
+        
+        return true;
+    }
 }



Mime
View raw message