1 11 package org.eclipse.update.internal.configurator; 12 13 import org.osgi.framework.Version; 14 15 public class VersionedIdentifier { 16 private String identifier; 17 private Version version; 18 19 public VersionedIdentifier(String id, String version) { 20 this.identifier = id; 21 this.version = Version.parseVersion(version); 22 } 23 24 public Version getVersion() { 25 return version; 26 } 27 28 public String getIdentifier() { 29 return identifier; 30 } 31 32 private boolean equalIdentifiers(VersionedIdentifier id) { 33 if (id == null) 34 return identifier == null; 35 return id.identifier.equals(identifier); 36 } 37 38 41 public boolean equals(Object obj) { 42 if (this == obj) 43 return true; 44 if (!(obj instanceof VersionedIdentifier)) 45 return false; 46 47 VersionedIdentifier other = (VersionedIdentifier) obj; 48 if (!equalIdentifiers(other)) 49 return false; 50 return version.equals(other.getVersion()); 51 } 52 53 56 public int hashCode() { 57 return (identifier + "_" + getVersion()).hashCode(); } 59 60 63 public String toString() { 64 return identifier + "_" + getVersion(); } 66 } | Popular Tags |