directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r581006 - in /directory/studio/trunk/studio-schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/wrappers: AbstractTreeNode.java AttributeTypeWrapper.java ObjectClassWrapper.java SchemaWrapper.java
Date Mon, 01 Oct 2007 16:24:16 GMT
Author: pamarcelot
Date: Mon Oct  1 09:24:12 2007
New Revision: 581006

URL: http://svn.apache.org/viewvc?rev=581006&view=rev
Log:
Added 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/ObjectClassWrapper.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=581006&r1=581005&r2=581006&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
Mon Oct  1 09:24:12 2007
@@ -139,4 +139,40 @@
 
         return fChildren.addAll( c );
     }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof AbstractTreeNode )
+        {
+            AbstractTreeNode atn = ( AbstractTreeNode ) obj;
+
+            if ( fParent != null )
+            {
+                return fParent.equals( atn.getParent() );
+            }
+        }
+
+        // Default
+        return false;
+    }
+
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode()
+    {
+        int result = 17;
+
+        if ( fParent != null )
+        {
+            result = 37 * result + fParent.hashCode();
+        }
+
+        return result;
+    }
 }

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=581006&r1=581005&r2=581006&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
Mon Oct  1 09:24:12 2007
@@ -73,4 +73,43 @@
     {
         return attributeType;
     }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.schemaeditor.view.wrappers.AbstractTreeNode#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof AttributeTypeWrapper )
+        {
+            if ( super.equals( obj ) )
+            {
+                AttributeTypeWrapper atw = ( AttributeTypeWrapper ) obj;
+
+                if ( attributeType != null )
+                {
+                    return attributeType.equals( atw.getAttributeType() );
+                }
+            }
+        }
+
+        // Default
+        return false;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.schemaeditor.view.wrappers.AbstractTreeNode#hashCode()
+     */
+    public int hashCode()
+    {
+        int result = super.hashCode();
+
+        if ( attributeType != null )
+        {
+            result = 37 * result + attributeType.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=581006&r1=581005&r2=581006&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
Mon Oct  1 09:24:12 2007
@@ -73,4 +73,43 @@
     {
         return objectClass;
     }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.schemaeditor.view.wrappers.AbstractTreeNode#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof ObjectClassWrapper )
+        {
+            if ( super.equals( obj ) )
+            {
+                ObjectClassWrapper ocw = ( ObjectClassWrapper ) obj;
+
+                if ( objectClass != null )
+                {
+                    return objectClass.equals( ocw.getObjectClass() );
+                }
+            }
+        }
+
+        // Default
+        return false;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.schemaeditor.view.wrappers.AbstractTreeNode#hashCode()
+     */
+    public int hashCode()
+    {
+        int result = super.hashCode();
+
+        if ( objectClass != null )
+        {
+            result = 37 * result + objectClass.hashCode();
+        }
+
+        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=581006&r1=581005&r2=581006&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
Mon Oct  1 09:24:12 2007
@@ -73,4 +73,43 @@
     {
         return schema;
     }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.schemaeditor.view.wrappers.AbstractTreeNode#equals(java.lang.Object)
+     */
+    public boolean equals( Object obj )
+    {
+        if ( obj instanceof SchemaWrapper )
+        {
+            if ( super.equals( obj ) )
+            {
+                SchemaWrapper sw = ( SchemaWrapper ) obj;
+
+                if ( schema != null )
+                {
+                    return schema.equals( sw.getSchema() );
+                }
+            }
+        }
+
+        // Default
+        return false;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.studio.schemaeditor.view.wrappers.AbstractTreeNode#hashCode()
+     */
+    public int hashCode()
+    {
+        int result = super.hashCode();
+
+        if ( schema != null )
+        {
+            result = 37 * result + schema.hashCode();
+        }
+
+        return result;
+    }
 }



Mime
View raw message