From ddac26dd4d1aafeaa714f2eb77cbfc7d244a053f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 31 May 2008 04:02:24 +0000 Subject: bugfix! --- sources/core/VSTask.java | 9 ++++++--- sources/core/VSTaskManager.java | 16 ++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'sources/core') diff --git a/sources/core/VSTask.java b/sources/core/VSTask.java index c7b378d..1716f02 100644 --- a/sources/core/VSTask.java +++ b/sources/core/VSTask.java @@ -273,9 +273,11 @@ public class VSTask implements Comparable { else if (taskTime > task.getTaskTime()) return 1; + VSAbstractEvent event2 = task.getEvent(); + /* If it's a recovering, it should get handled very first */ boolean a = event instanceof VSProcessRecoverEvent; - boolean b = task.getEvent() instanceof VSProcessRecoverEvent; + boolean b = event2 instanceof VSProcessRecoverEvent; if (a && b) return 0; @@ -288,7 +290,7 @@ public class VSTask implements Comparable { /* If it's a crash, it should get handled second first */ a = event instanceof VSProcessCrashEvent; - b = task.getEvent() instanceof VSProcessCrashEvent; + b = event2 instanceof VSProcessCrashEvent; if (a && b) return 0; @@ -301,7 +303,7 @@ public class VSTask implements Comparable { /* If it's a VSProtocolEvent, it should get handled third */ a = event instanceof VSProtocolEvent; - b = task.getEvent() instanceof VSProtocolEvent; + b = event2 instanceof VSProtocolEvent; if (a && b) return 0; @@ -312,6 +314,7 @@ public class VSTask implements Comparable { if (b) return 1; + return event.getShortname().compareTo(event2.getShortname()); } return 0; diff --git a/sources/core/VSTaskManager.java b/sources/core/VSTaskManager.java index b12b093..7d57eea 100644 --- a/sources/core/VSTaskManager.java +++ b/sources/core/VSTaskManager.java @@ -348,8 +348,8 @@ public class VSTaskManager { * * @return the local timed tasks */ - public synchronized VSPriorityQueue getLocalTasks() { - VSPriorityQueue localTasks = new VSPriorityQueue(); + public synchronized ArrayList getLocalTasks() { + ArrayList localTasks = new ArrayList(); Vector processes = simulatorCanvas.getProcesses(); for (VSTask task : fullfilledProgrammedTasks) @@ -372,8 +372,8 @@ public class VSTaskManager { * * @return the global timed tasks */ - public synchronized VSPriorityQueue getGlobalTasks() { - VSPriorityQueue globalTasks = new VSPriorityQueue(); + public synchronized ArrayList getGlobalTasks() { + ArrayList globalTasks = new ArrayList(); for (VSTask task : fullfilledProgrammedTasks) if (task.isGlobalTimed()) @@ -393,9 +393,9 @@ public class VSTaskManager { * * @return the local tasks of the specified process */ - public synchronized VSPriorityQueue getProcessLocalTasks( + public synchronized ArrayList getProcessLocalTasks( VSProcess process) { - VSPriorityQueue processTasks = new VSPriorityQueue(); + ArrayList processTasks = new ArrayList(); VSPriorityQueue tasks = process.getTasks(); for (VSTask task : fullfilledProgrammedTasks) @@ -417,9 +417,9 @@ public class VSTaskManager { * * @return the global timed tasks of the specified process */ - public synchronized VSPriorityQueue getProcessGlobalTasks( + public synchronized ArrayList getProcessGlobalTasks( VSProcess process) { - VSPriorityQueue processTasks = new VSPriorityQueue(); + ArrayList processTasks = new ArrayList(); for (VSTask task : fullfilledProgrammedTasks) if (task.isGlobalTimed() && task.isProcess(process) && -- cgit v1.2.3