Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2009-02-23 00:57:31 +0000
committerslewis2009-02-23 00:57:31 +0000
commitc9419836d7a7410dfc63a652163248b426aeb040 (patch)
tree490bb4168360af1c209bd53671943d8f4cab4783 /framework/bundles/org.eclipse.ecf.identity
parentcb3aa7a02c72b9a3d0332cc020ab3d81c839cdc1 (diff)
downloadorg.eclipse.ecf-c9419836d7a7410dfc63a652163248b426aeb040.tar.gz
org.eclipse.ecf-c9419836d7a7410dfc63a652163248b426aeb040.tar.xz
org.eclipse.ecf-c9419836d7a7410dfc63a652163248b426aeb040.zip
Additions for RFC 119 support. See bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=249240#c11
Diffstat (limited to 'framework/bundles/org.eclipse.ecf.identity')
-rw-r--r--framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/BaseID.java39
1 files changed, 25 insertions, 14 deletions
diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/BaseID.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/BaseID.java
index c4378c6c9..8cebd0fba 100644
--- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/BaseID.java
+++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/identity/BaseID.java
@@ -41,7 +41,8 @@ public abstract class BaseID implements ID {
* @see java.lang.Comparable#compareTo(T)
*/
public int compareTo(Object o) {
- Assert.isTrue(o != null && o instanceof BaseID, "incompatible types for compare"); //$NON-NLS-1$
+ Assert.isTrue(o != null && o instanceof BaseID,
+ "incompatible types for compare"); //$NON-NLS-1$
return namespace.getCompareToForObject(this, (BaseID) o);
}
@@ -51,9 +52,9 @@ public abstract class BaseID implements ID {
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object o) {
- if (o == null)
- return false;
- if (!(o instanceof BaseID)) {
+ if (this == o)
+ return true;
+ if (o == null || !(o instanceof BaseID)) {
return false;
}
return namespace.testIDEquals(this, (BaseID) o);
@@ -98,42 +99,51 @@ public abstract class BaseID implements ID {
/**
* Called by {@link Namespace#getCompareToForObject(BaseID, BaseID)}.
*
- * @param o the other ID to compare to. Will not be <code>null</code>.
+ * @param o
+ * the other ID to compare to. Will not be <code>null</code>.
* @return the appropriate value as per {@link Comparable} contract.
*/
protected abstract int namespaceCompareTo(BaseID o);
/**
* Called by {@link Namespace#testIDEquals(BaseID, BaseID)}.
- * @param o the other ID to test against. May be <code>null</code>.
- * @return <code>true</code> if this ID is equal to the given ID. <code>false</code> otherwise.
+ *
+ * @param o
+ * the other ID to test against. May be <code>null</code>.
+ * @return <code>true</code> if this ID is equal to the given ID.
+ * <code>false</code> otherwise.
*/
protected abstract boolean namespaceEquals(BaseID o);
/**
* Called by {@link Namespace#getNameForID(BaseID)}.
*
- * @return String name for this ID. Must not be <code>null</code>. Value returned should be unique within this Namespace.
+ * @return String name for this ID. Must not be <code>null</code>. Value
+ * returned should be unique within this Namespace.
*/
protected abstract String namespaceGetName();
/**
* Called by {@link Namespace#getHashCodeForID(BaseID)}.
*
- * @return int hashCode for this ID. Returned value must be unique within this process.
+ * @return int hashCode for this ID. Returned value must be unique within
+ * this process.
*/
protected abstract int namespaceHashCode();
/**
- * Called by {@link Namespace#toExternalForm(BaseID)}.
+ * Called by {@link Namespace#toExternalForm(BaseID)}.
+ *
+ * @return String that represents this ID. Default implementation is to
+ * return
*
- * @return String that represents this ID. Default implementation is to return
- * <pre>
+ * <pre>
* namespace.getScheme() + Namespace.SCHEME_SEPARATOR + namespaceGetName();
* </pre>
*/
protected String namespaceToExternalForm() {
- return namespace.getScheme() + Namespace.SCHEME_SEPARATOR + namespaceGetName();
+ return namespace.getScheme() + Namespace.SCHEME_SEPARATOR
+ + namespaceGetName();
}
/*
@@ -142,7 +152,8 @@ public abstract class BaseID implements ID {
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
public Object getAdapter(Class clazz) {
- IAdapterManager adapterManager = Activator.getDefault().getAdapterManager();
+ IAdapterManager adapterManager = Activator.getDefault()
+ .getAdapterManager();
if (adapterManager == null)
return null;
return adapterManager.loadAdapter(this, clazz.getName());

Back to the top