TimerTaskDef moved out of Scheduler class, renamed to Event

This commit is contained in:
7u83 2018-12-18 01:10:08 +01:00
parent 648e9d5863
commit fb8295d3b1
2 changed files with 14 additions and 9 deletions

View File

@ -612,11 +612,7 @@ public class SeSimApplication extends javax.swing.JFrame {
this.world = world;
}
@Override
public long getID() {
return 1;
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public long receive(opensesim.world.scheduler.Event task) {

View File

@ -25,7 +25,6 @@
*/
package opensesim.world.scheduler;
import java.util.Comparator;
import java.util.Date;
import java.util.LinkedList;
import java.util.SortedMap;
@ -63,7 +62,7 @@ public class Scheduler extends Thread {
long receive(Event task);
long getID();
// long getID();
}
private boolean terminate = false;
@ -88,7 +87,7 @@ public class Scheduler extends Thread {
super.start();
}
private class ObjectComparator implements Comparator<Object> {
/* private class ObjectComparator implements Comparator<Object> {
@Override
public int compare(Object o1, Object o2) {
@ -97,7 +96,8 @@ public class Scheduler extends Thread {
//return System.identityHashCode(o1) - System.identityHashCode(o2);
}
}
*/
long last_time_millis = System.currentTimeMillis();
double current_time_millis = 0.0;
@ -188,6 +188,15 @@ public class Scheduler extends Thread {
}
return task;
}
public Event scheduleEvent(Event e){
new_tasks.add(e);
synchronized (this) {
notify();
}
return e;
}
public void rescheduleTimerTask(Event task, long time) {
long evtime = time + currentTimeMillis();