diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Feature.java')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Feature.java | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Feature.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Feature.java new file mode 100644 index 000000000..54ca2d0bb --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/update/Feature.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * Copyright (c) 2007 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.internal.p2.update; + +/* + * Represents a feature entry in a platform.xml file. + */ +public class Feature { + + private String id; + private String url; + private String version; + private Site site; + + public Feature(Site site) { + super(); + if (site == null) + throw new IllegalArgumentException("Features should not have an empty site."); //$NON-NLS-1$ + this.site = site; + } + + public String getId() { + return id; + } + + public Site getSite() { + return site; + } + + public String getUrl() { + return url; + } + + public String getVersion() { + return version; + } + + public void setId(String id) { + this.id = id; + } + + public void setUrl(String url) { + this.url = url; + } + + public void setVersion(String version) { + this.version = version; + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object obj) { + if (!(obj instanceof Feature)) + return false; + Feature other = (Feature) obj; + if (!equals(getId(), other.getId())) + return false; + // shallow equals here. sites should never be null + if (!equals(getSite().getUrl(), other.getSite().getUrl())) + return false; + if (!equals(getUrl(), other.getUrl())) + return false; + if (!equals(getVersion(), other.getVersion())) + return false; + return true; + } + + private boolean equals(Object one, Object two) { + return one == null ? two == null : one.equals(two); + } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + return super.hashCode(); + } +} |