commit | 52cfc7c6410ad798f7da9eabaec7dfceef2dd64b | [log] [tgz] |
---|---|---|
author | David Morgan Spencer Savage <dsavage@apache.org> | Tue Mar 02 11:54:18 2010 +0000 |
committer | David Morgan Spencer Savage <dsavage@apache.org> | Tue Mar 02 11:54:18 2010 +0000 |
tree | 2fac46bc660540d5036fe8e1c8b404625b09a4f5 | |
parent | 099d199c2a5411a3ed24ca2212aac7349424f9a6 [diff] |
Implement equals and hashCode methods git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@917980 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java b/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java index d3ab4b9..4520113 100644 --- a/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java +++ b/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java
@@ -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; + } }