Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-06-25 03:00:07 +0000
committermkersten2007-06-25 03:00:07 +0000
commit49d2f47f7f707a8d71bbd28dbf877f3e1ad7abbd (patch)
treeeba315121a2e93aafc4334a61a4bcc5afa0c8ebb
parentbcb8306e54d59b3dc39138f5e1305ba20b637174 (diff)
downloadorg.eclipse.mylyn.tasks-49d2f47f7f707a8d71bbd28dbf877f3e1ad7abbd.tar.gz
org.eclipse.mylyn.tasks-49d2f47f7f707a8d71bbd28dbf877f3e1ad7abbd.tar.xz
org.eclipse.mylyn.tasks-49d2f47f7f707a8d71bbd28dbf877f3e1ad7abbd.zip
RESOLVED - bug 185351: [performance] Need to optimize calculation of Task hash code
https://bugs.eclipse.org/bugs/show_bug.cgi?id=185351
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java12
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java18
2 files changed, 19 insertions, 11 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java
index 0d1fab236..05582d03b 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java
@@ -169,10 +169,13 @@ public abstract class AbstractTask extends AbstractTaskContainer {
this.url = "";
}
+ /**
+ * Final to preserve the handle identifier format required by the framework.
+ */
public final String getHandleIdentifier() {
- return RepositoryTaskHandleUtil.getHandle(repositoryUrl, taskId);
+ return super.getHandleIdentifier();
}
-
+
/**
* True for tasks that can be modified without a round-trip to a server. For example, such a task can be marked
* completed via the Task List.
@@ -237,8 +240,13 @@ public abstract class AbstractTask extends AbstractTaskContainer {
return repositoryUrl;
}
+ public final void setHandleIdentifier(String handleIdentifier) {
+ throw new RuntimeException("Cannot set the handle identifier of a task, set repository URL instead.");
+ }
+
public final void setRepositoryUrl(String repositoryUrl) {
this.repositoryUrl = repositoryUrl;
+ super.setHandleIdentifier(RepositoryTaskHandleUtil.getHandle(repositoryUrl, taskId));
}
/**
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java
index 2917de9e6..b6b9edc99 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java
@@ -25,7 +25,7 @@ import org.eclipse.mylyn.tasks.core.AbstractTask.PriorityLevel;
*/
public abstract class AbstractTaskContainer extends PlatformObject implements Comparable<AbstractTaskContainer> {
- private String handle = "";
+ private String handleIdentifier = "";
private Set<AbstractTask> children = new CopyOnWriteArraySet<AbstractTask>();
@@ -35,8 +35,8 @@ public abstract class AbstractTaskContainer extends PlatformObject implements Co
protected String url = null;
public AbstractTaskContainer(String handleAndDescription) {
- assert handle != null;
- this.handle = handleAndDescription;
+ assert handleIdentifier != null;
+ this.handleIdentifier = handleAndDescription;
}
/**
@@ -74,7 +74,7 @@ public abstract class AbstractTaskContainer extends PlatformObject implements Co
}
public String getSummary() {
- return handle;
+ return handleIdentifier;
}
public boolean isEmpty() {
@@ -82,16 +82,16 @@ public abstract class AbstractTaskContainer extends PlatformObject implements Co
}
public String getHandleIdentifier() {
- return handle;
+ return handleIdentifier;
}
- public void setHandleIdentifier(String handle) {
- this.handle = handle;
+ public void setHandleIdentifier(String handleIdentifier) {
+ this.handleIdentifier = handleIdentifier;
}
@Override
public int hashCode() {
- return handle.hashCode();
+ return handleIdentifier.hashCode();
}
public void setUrl(String url) {
@@ -119,7 +119,7 @@ public abstract class AbstractTaskContainer extends PlatformObject implements Co
@Override
public String toString() {
- return "container: " + handle;
+ return "container: " + handleIdentifier;
}
public String getPriority() {

Back to the top