diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-19 00:46:35 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-19 00:46:35 +0000 |
| commit | f3644572ea68aacf96ce5a1a9b9e5ce2cf617d95 (patch) | |
| tree | 385c45b107d939ffc099e4d08b03d325ca6c0823 | |
| parent | 36f74586cc61f5899c16b6f84a04be37688cc719 (diff) | |
local process time goes on if process is crashed. simulates BIOS time.
| -rw-r--r-- | sources/core/VSProcess.java | 4 | ||||
| -rw-r--r-- | sources/core/VSTask.java | 12 | ||||
| -rw-r--r-- | sources/core/VSTaskManager.java | 8 |
3 files changed, 19 insertions, 5 deletions
diff --git a/sources/core/VSProcess.java b/sources/core/VSProcess.java index d2fe934..7e50abe 100644 --- a/sources/core/VSProcess.java +++ b/sources/core/VSProcess.java @@ -164,10 +164,10 @@ public final class VSProcess extends VSPrefs { final long currentGlobalTimestep = globalTime - this.globalTime; this.globalTime = globalTime; - if (!isCrashed) { + //if (!isCrashed) { localTime += currentGlobalTimestep; clockOffset += currentGlobalTimestep * (double) clockVariance; - } + //} while (clockOffset >= 1) { clockOffset -= 1; diff --git a/sources/core/VSTask.java b/sources/core/VSTask.java index 3869e7c..a476e35 100644 --- a/sources/core/VSTask.java +++ b/sources/core/VSTask.java @@ -175,6 +175,18 @@ public class VSTask implements Comparable { else if (taskTime > task.getTaskTime()) return 1; + + boolean a = event instanceof ProtocolEvent; + boolean b = task.getEvent() instanceof ProtocolEvent; + + if (a && b) + return 0; + + if (a) + return -1; + + if (b) + return 1; } return 0; diff --git a/sources/core/VSTaskManager.java b/sources/core/VSTaskManager.java index 6683e71..7e24cf3 100644 --- a/sources/core/VSTaskManager.java +++ b/sources/core/VSTaskManager.java @@ -16,12 +16,13 @@ public class VSTaskManager { public VSTaskManager(VSPrefs prefs) { this.prefs = prefs; - Comparator<VSTask> comparator = createComparator(); - this.tasks = new PriorityQueue<VSTask>(100, comparator); - this.globalTasks = new PriorityQueue<VSTask>(100, comparator); + //Comparator<VSTask> comparator = createComparator(); + this.tasks = new PriorityQueue<VSTask>();//100, comparator); + this.globalTasks = new PriorityQueue<VSTask>();//(100, comparator); this.fullfilledProgrammedTasks = new LinkedList<VSTask>(); } + /* private Comparator<VSTask> createComparator() { return new Comparator<VSTask>() { public int compare(VSTask a, VSTask b) { @@ -35,6 +36,7 @@ public class VSTaskManager { } }; } + */ public synchronized void runTasks(final long step, final long offset, final long lastGlobalTime) { VSTask task = null; |
