summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-05-31 04:02:24 +0000
committerPaul Buetow <paul@buetow.org>2008-05-31 04:02:24 +0000
commitddac26dd4d1aafeaa714f2eb77cbfc7d244a053f (patch)
tree9cc6d909fbff40db9484f6668c52b36fd03d8802 /sources
parentf32bc24469d0e0d8e184c6a27fe04b13f59d6fb0 (diff)
bugfix!
Diffstat (limited to 'sources')
-rw-r--r--sources/core/VSTask.java9
-rw-r--r--sources/core/VSTaskManager.java16
-rw-r--r--sources/prefs/VSPrefs.java3
-rw-r--r--sources/simulator/VSSimulator.java6
4 files changed, 21 insertions, 13 deletions
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<VSTask> getLocalTasks() {
- VSPriorityQueue<VSTask> localTasks = new VSPriorityQueue<VSTask>();
+ public synchronized ArrayList<VSTask> getLocalTasks() {
+ ArrayList<VSTask> localTasks = new ArrayList<VSTask>();
Vector<VSProcess> processes = simulatorCanvas.getProcesses();
for (VSTask task : fullfilledProgrammedTasks)
@@ -372,8 +372,8 @@ public class VSTaskManager {
*
* @return the global timed tasks
*/
- public synchronized VSPriorityQueue<VSTask> getGlobalTasks() {
- VSPriorityQueue<VSTask> globalTasks = new VSPriorityQueue<VSTask>();
+ public synchronized ArrayList<VSTask> getGlobalTasks() {
+ ArrayList<VSTask> globalTasks = new ArrayList<VSTask>();
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<VSTask> getProcessLocalTasks(
+ public synchronized ArrayList<VSTask> getProcessLocalTasks(
VSProcess process) {
- VSPriorityQueue<VSTask> processTasks = new VSPriorityQueue<VSTask>();
+ ArrayList<VSTask> processTasks = new ArrayList<VSTask>();
VSPriorityQueue<VSTask> 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<VSTask> getProcessGlobalTasks(
+ public synchronized ArrayList<VSTask> getProcessGlobalTasks(
VSProcess process) {
- VSPriorityQueue<VSTask> processTasks = new VSPriorityQueue<VSTask>();
+ ArrayList<VSTask> processTasks = new ArrayList<VSTask>();
for (VSTask task : fullfilledProgrammedTasks)
if (task.isGlobalTimed() && task.isProcess(process) &&
diff --git a/sources/prefs/VSPrefs.java b/sources/prefs/VSPrefs.java
index b0c9028..b4a9f73 100644
--- a/sources/prefs/VSPrefs.java
+++ b/sources/prefs/VSPrefs.java
@@ -957,7 +957,8 @@ public class VSPrefs implements Serializable {
* @throws IOException Signals that an I/O exception has occurred.
* @throws ClassNotFoundException the class not found exception
*/
- @SuppressWarnings("unchecked") public synchronized void readObject(ObjectInputStream objectInputStream)
+ @SuppressWarnings("unchecked")
+ public synchronized void readObject(ObjectInputStream objectInputStream)
throws IOException, ClassNotFoundException {
booleanPrefs = (HashMap<String,Boolean>) objectInputStream.readObject();
colorPrefs = (HashMap<String,Color>) objectInputStream.readObject();
diff --git a/sources/simulator/VSSimulator.java b/sources/simulator/VSSimulator.java
index 3efc09d..29cb5d7 100644
--- a/sources/simulator/VSSimulator.java
+++ b/sources/simulator/VSSimulator.java
@@ -160,6 +160,7 @@ public class VSSimulator extends JPanel {
* The class VSTaskManagerTableModel, an object of this class handles
* the task manager's JTable.
*/
+ @SuppressWarnings("unchecked")
private class VSTaskManagerTableModel extends AbstractTableModel
implements MouseListener {
/** the serial version uid */
@@ -181,7 +182,7 @@ public class VSSimulator extends JPanel {
public boolean allProcesses;
/** The tasks. */
- private VSPriorityQueue<VSTask> tasks;
+ private ArrayList<VSTask> tasks;
/** The column names. */
private String columnNames[];
@@ -200,6 +201,7 @@ public class VSSimulator extends JPanel {
* if this table manages the global tasks.
*/
public VSTaskManagerTableModel(VSProcess process, boolean localTask) {
+ tasks = new ArrayList<VSTask>();
set(process, localTask, ONE_PROCESS);
columnNames = new String[3];
columnNames[0]= prefs.getString("lang.time") + " (ms)";
@@ -240,6 +242,7 @@ public class VSSimulator extends JPanel {
: taskManager.getProcessGlobalTasks(process);
}
+ Collections.sort(tasks);
fireTableDataChanged();
}
@@ -302,6 +305,7 @@ public class VSSimulator extends JPanel {
*/
public void addTask(VSTask task) {
tasks.add(task);
+ Collections.sort(tasks);
fireTableDataChanged();
}