Commit 503e4024 authored by Michael Ritter's avatar Michael Ritter
Browse files

Add generics to Submittable so we get back the type of Thread

parent 5d19210e
......@@ -5,13 +5,13 @@ import edu.umiacs.ace.monitor.core.Collection;
/**
* Created by shake on 9/11/15.
*/
public class Submittable implements Comparable<Submittable> {
public class Submittable<V extends Runnable> implements Comparable<Submittable> {
final Collection collection;
final Runnable runnable;
final V runnable;
final RunType type;
RunState state;
Submittable(Collection collection, RunType type, Runnable runnable) {
Submittable(Collection collection, RunType type, V runnable) {
this.collection = collection;
this.runnable = runnable;
this.type = type;
......@@ -26,10 +26,14 @@ public class Submittable implements Comparable<Submittable> {
return state;
}
public Runnable getThread() {
public V getThread() {
return runnable;
}
public RunType getType() {
return type;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
......@@ -49,7 +53,8 @@ public class Submittable implements Comparable<Submittable> {
}
public int compareTo(Submittable submittable) {
return (int) (this.collection.getId() - submittable.collection.getId());
return (int) (this.collection.getId() - submittable.collection.getId())
+ (this.getType().ordinal() - submittable.getType().ordinal());
}
public enum RunType {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment