TimerTaskDef moved out of Scheduler class, renamed to Event
This commit is contained in:
parent
648e9d5863
commit
fb8295d3b1
@ -612,11 +612,7 @@ public class SeSimApplication extends javax.swing.JFrame {
|
|||||||
this.world = world;
|
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
|
@Override
|
||||||
public long receive(opensesim.world.scheduler.Event task) {
|
public long receive(opensesim.world.scheduler.Event task) {
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
*/
|
*/
|
||||||
package opensesim.world.scheduler;
|
package opensesim.world.scheduler;
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
@ -63,7 +62,7 @@ public class Scheduler extends Thread {
|
|||||||
|
|
||||||
long receive(Event task);
|
long receive(Event task);
|
||||||
|
|
||||||
long getID();
|
// long getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean terminate = false;
|
private boolean terminate = false;
|
||||||
@ -88,7 +87,7 @@ public class Scheduler extends Thread {
|
|||||||
super.start();
|
super.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ObjectComparator implements Comparator<Object> {
|
/* private class ObjectComparator implements Comparator<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(Object o1, Object o2) {
|
||||||
@ -97,6 +96,7 @@ public class Scheduler extends Thread {
|
|||||||
//return System.identityHashCode(o1) - System.identityHashCode(o2);
|
//return System.identityHashCode(o1) - System.identityHashCode(o2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
long last_time_millis = System.currentTimeMillis();
|
long last_time_millis = System.currentTimeMillis();
|
||||||
double current_time_millis = 0.0;
|
double current_time_millis = 0.0;
|
||||||
@ -189,6 +189,15 @@ public class Scheduler extends Thread {
|
|||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Event scheduleEvent(Event e){
|
||||||
|
new_tasks.add(e);
|
||||||
|
synchronized (this) {
|
||||||
|
notify();
|
||||||
|
}
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
public void rescheduleTimerTask(Event task, long time) {
|
public void rescheduleTimerTask(Event task, long time) {
|
||||||
long evtime = time + currentTimeMillis();
|
long evtime = time + currentTimeMillis();
|
||||||
task.newevtime = evtime;
|
task.newevtime = evtime;
|
||||||
|
Loading…
Reference in New Issue
Block a user