felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsav...@apache.org
Subject svn commit: r917980 - /felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java
Date Tue, 02 Mar 2010 11:54:18 GMT
Author: dsavage
Date: Tue Mar  2 11:54:18 2010
New Revision: 917980

URL: http://svn.apache.org/viewvc?rev=917980&view=rev
Log:
Implement equals and hashCode methods

Modified:
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java?rev=917980&r1=917979&r2=917980&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java
(original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java
Tue Mar  2 11:54:18 2010
@@ -166,4 +166,31 @@
             }
         }
     }
+
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if ( obj == null ) return false;
+        if ( obj == this ) return true;
+        try {
+            PackageExport e = (PackageExport) obj;
+            return name == null ? e.name == null : name.equals( e.name ) && 
+                version == null ? e.version == null : version.equals( e.version );
+        }
+        catch (ClassCastException e) {
+            return false;
+        }
+    }
+
+
+    @Override
+    public int hashCode()
+    {
+        int hc = name.hashCode();
+        
+        if ( version != null ) hc *= version.hashCode();
+        
+        return hc;
+    }
 }



Mime
View raw message