directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r581197 - /directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/
Date Tue, 02 Oct 2007 11:42:59 GMT
Author: pamarcelot
Date: Tue Oct  2 04:42:58 2007
New Revision: 581197

URL: http://svn.apache.org/viewvc?rev=581197&view=rev
Log:
Updated equals() and hashCode() methods.

Modified:
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AbstractTreeNode.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AttributeTypeWrapper.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/Folder.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ObjectClassWrapper.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ProjectWrapper.java
    directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaWrapper.java

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AbstractTreeNode.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AbstractTreeNode.java?rev=581197&r1=581196&r2=581197&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AbstractTreeNode.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AbstractTreeNode.java
Tue Oct  2 04:42:58 2007
@@ -150,10 +150,12 @@
         {
             AbstractTreeNode atn = ( AbstractTreeNode ) obj;
 
-            if ( fParent != null )
+            if ( ( fParent != null ) && ( !fParent.equals( atn.getParent() ) ) )
             {
-                return fParent.equals( atn.getParent() );
+                return false;
             }
+
+            return true;
         }
 
         // Default

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AttributeTypeWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AttributeTypeWrapper.java?rev=581197&r1=581196&r2=581197&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AttributeTypeWrapper.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/AttributeTypeWrapper.java
Tue Oct  2 04:42:58 2007
@@ -86,10 +86,12 @@
             {
                 AttributeTypeWrapper atw = ( AttributeTypeWrapper ) obj;
 
-                if ( attributeType != null )
+                if ( ( attributeType != null ) && ( !attributeType.equals( atw.getAttributeType()
) ) )
                 {
-                    return attributeType.equals( atw.getAttributeType() );
+                    return false;
                 }
+
+                return true;
             }
         }
 

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/Folder.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/Folder.java?rev=581197&r1=581196&r2=581197&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/Folder.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/Folder.java
Tue Oct  2 04:42:58 2007
@@ -153,4 +153,25 @@
 
         return false;
     }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.schemaeditor.view.wrappers.AbstractTreeNode#hashCode()
+     */
+    public int hashCode()
+    {
+        int result = super.hashCode();
+
+        if ( name != null )
+        {
+            result = 37 * result + name.hashCode();
+        }
+
+        if ( type != null )
+        {
+            result = 37 * result + type.hashCode();
+        }
+
+        return result;
+    }
 }

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ObjectClassWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ObjectClassWrapper.java?rev=581197&r1=581196&r2=581197&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ObjectClassWrapper.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ObjectClassWrapper.java
Tue Oct  2 04:42:58 2007
@@ -86,10 +86,12 @@
             {
                 ObjectClassWrapper ocw = ( ObjectClassWrapper ) obj;
 
-                if ( objectClass != null )
+                if ( ( objectClass != null ) && ( !objectClass.equals( ocw.getObjectClass()
) ) )
                 {
-                    return objectClass.equals( ocw.getObjectClass() );
+                    return false;
                 }
+
+                return true;
             }
         }
 

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ProjectWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ProjectWrapper.java?rev=581197&r1=581196&r2=581197&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ProjectWrapper.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/ProjectWrapper.java
Tue Oct  2 04:42:58 2007
@@ -91,9 +91,32 @@
     {
         if ( obj instanceof ProjectWrapper )
         {
-            return getProject().equals( ( ( ProjectWrapper ) obj ).getProject() );
+            ProjectWrapper projectWrapper = ( ProjectWrapper ) obj;
+
+            if ( ( project != null ) && ( !project.equals( projectWrapper.getProject()
) ) )
+            {
+                return false;
+            }
+
+            return true;
+        }
+
+        return false;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.schemaeditor.view.wrappers.AbstractTreeNode#hashCode()
+     */
+    public int hashCode()
+    {
+        int result = super.hashCode();
+
+        if ( project != null )
+        {
+            result = 37 * result + project.hashCode();
         }
 
-        return super.equals( obj );
+        return result;
     }
 }

Modified: directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaWrapper.java?rev=581197&r1=581196&r2=581197&view=diff
==============================================================================
--- directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaWrapper.java
(original)
+++ directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers/SchemaWrapper.java
Tue Oct  2 04:42:58 2007
@@ -86,10 +86,12 @@
             {
                 SchemaWrapper sw = ( SchemaWrapper ) obj;
 
-                if ( schema != null )
+                if ( ( schema != null ) && ( !schema.equals( sw.getSchema() ) ) )
                 {
-                    return schema.equals( sw.getSchema() );
+                    return false;
                 }
+
+                return true;
             }
         }
 



Mime
View raw message