diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-22 15:35:52 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-22 15:35:52 +0000 |
| commit | 68ca748737bbf5af57888872a9c072415e609d23 (patch) | |
| tree | bc03b77a1e976e7672ea3b26c6ddd61df265776a | |
| parent | f7b023c5cff7dae854a015889bd217f3b84f6e07 (diff) | |
Simplemode/expertmode bugfix.
| -rw-r--r-- | sources/core/VSTask.java | 4 | ||||
| -rw-r--r-- | sources/core/VSTaskManager.java | 63 | ||||
| -rw-r--r-- | sources/prefs/editors/VSSimulationEditor.java | 6 | ||||
| -rw-r--r-- | sources/simulator/VSSimulation.java | 16 |
4 files changed, 10 insertions, 79 deletions
diff --git a/sources/core/VSTask.java b/sources/core/VSTask.java index b8a773a..8f1e634 100644 --- a/sources/core/VSTask.java +++ b/sources/core/VSTask.java @@ -63,7 +63,7 @@ public class VSTask implements Comparable { } public boolean isProcess(VSProcess process) { - return process.equals(process); + return this.process.equals(process); } public boolean isGlobalTimed() { @@ -98,6 +98,8 @@ public class VSTask implements Comparable { buffer.append(" "); buffer.append(getTaskTime()); buffer.append(event.toString()); + buffer.append("; PID: "); + buffer.append(process.getProcessID()); return buffer.toString(); } diff --git a/sources/core/VSTaskManager.java b/sources/core/VSTaskManager.java index e5adfac..66913fc 100644 --- a/sources/core/VSTaskManager.java +++ b/sources/core/VSTaskManager.java @@ -216,69 +216,6 @@ public class VSTaskManager { return false; } - /* - public synchronized LinkedList<VSTask> getProtocolTasks(VSProtocol protocol) { - LinkedList<VSTask> protocolTasks = new LinkedList<VSTask>(); - - for (VSTask task : fullfilledProgrammedTasks) - if (task.isProtocol(protocol)) - protocolTasks.addLast(task); - - for (VSTask task : globalTasks) - if (task.isProtocol(protocol)) - protocolTasks.addLast(task); - - for (VSTask task : tasks) - if (task.isProtocol(protocol)) - protocolTasks.addLast(task); - - return protocolTasks; - } - - public synchronized LinkedList<VSTask> getNonProtocolTasks(VSProtocol protocol) { - LinkedList<VSTask> nonProtocolTasks = new LinkedList<VSTask>(); - - for (VSTask task : fullfilledProgrammedTasks) - if (!task.isProtocol(protocol)) - nonProtocolTasks.addLast(task); - - for (VSTask task : globalTasks) - if (!task.isProtocol(protocol)) - nonProtocolTasks.addLast(task); - - for (VSTask task : tasks) - if (!task.isProtocol(protocol)) - nonProtocolTasks.addLast(task); - - return nonProtocolTasks; - } - - public synchronized void modifyProtocolTasks(VSProtocol protocol, LinkedList<VSTask> protocolTasks) { - VSProcess process = protocol.getProcess(); - LinkedList<VSTask> nonProtocolTasks = getNonProtocolTasks(protocol); - ListIterator<VSTask> iter1 = protocolTasks.listIterator(0); - ListIterator<VSTask> iter2 = nonProtocolTasks.listIterator(0); - long localTime = process.getTime(); - - fullfilledProgrammedTasks.clear(); - globalTasks.clear(); - tasks.clear(); - - for (VSTask task : nonProtocolTasks) { - if (task.getTaskTime() < localTime) - fullfilledProgrammedTasks.addLast(task); - else - insert(task); - } - - for (VSTask task : protocolTasks) { - if (task.getTaskTime() < localTime) - fullfilledProgrammedTasks.addLast(task); - else - insert(task); - } - } - */ public synchronized VSPriorityQueue<VSTask> getLocalTasks() { VSPriorityQueue<VSTask> processTasks = new VSPriorityQueue<VSTask>(); diff --git a/sources/prefs/editors/VSSimulationEditor.java b/sources/prefs/editors/VSSimulationEditor.java index f0106fd..86706cb 100644 --- a/sources/prefs/editors/VSSimulationEditor.java +++ b/sources/prefs/editors/VSSimulationEditor.java @@ -51,14 +51,16 @@ public class VSSimulationEditor extends VSBetterEditor { if (actionCommand.equals(prefs.getString("lang.takeover"))) { savePrefs(); if (expertModeChanged()) { - simulation.fireExpertModeChanged(); + if (simulation != null) + simulation.fireExpertModeChanged(); } simulation.updateFromPrefs(); } else if (actionCommand.equals(prefs.getString("lang.ok"))) { savePrefs(); if (expertModeChanged()) { - simulation.fireExpertModeChanged(); + if (simulation != null) + simulation.fireExpertModeChanged(); } if (!dontStartNewSimulation) simulatorFrame.addSimulation(new VSSimulation(prefsToEdit, simulatorFrame)); diff --git a/sources/simulator/VSSimulation.java b/sources/simulator/VSSimulation.java index 3af712c..4da367b 100644 --- a/sources/simulator/VSSimulation.java +++ b/sources/simulator/VSSimulation.java @@ -153,7 +153,7 @@ public class VSSimulation extends JPanel { splitPaneH.setLeftComponent(createProcessPane()); splitPaneH.setRightComponent(canvasPanel); splitPaneH.setContinuousLayout(true); - //splitPaneH.setOneTouchExpandable(true); + splitPaneH.setOneTouchExpandable(true); splitPaneV.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPaneV.setTopComponent(splitPaneH); @@ -295,7 +295,6 @@ public class VSSimulation extends JPanel { splitPane1 = new JSplitPane(); splitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT); - //splitPane1.setTopComponent(localPanel); splitPane1.setTopComponent(localPanel); splitPane1.setBottomComponent(globalPanel); splitPane1.setOneTouchExpandable(true); @@ -340,13 +339,6 @@ public class VSSimulation extends JPanel { }); tabbedPane.add(prefs.getString("lang.variables"), null); - //tabbedPane.add(prefs.getString("lang.variables.global"), null); - - /* - VSSimulationEditor.TAKEOVER_BUTTON = true; - VSSimulationEditor editor = new VSSimulationEditor(prefs, simulatorFrame); - tabbedPane.setComponentAt(2, editor.getContentPane()); - */ editPanel.add(processesComboBox); editPanel.add(tabbedPane); @@ -895,20 +887,18 @@ public class VSSimulation extends JPanel { splitPane1.setDividerLocation((int) (getPaintSize()/2) - 20); /* addPanel */ - localAddPanel.add(localPIDComboBox, 1); + localAddPanel.add(localPIDComboBox, 2); } else { tabbedPane.remove(splitPane1); tabbedPane.insertTab(prefs.getString("lang.events"), null, localPanel, null, 0); /* addPanel */ - localAddPanel.remove(1); + localAddPanel.remove(2); } tabbedPane.setSelectedIndex(selectedIndex); - - /* Update the tools panel */ loggingPanel.remove(1); loggingPanel.add(createToolsPanel(), BorderLayout.SOUTH); |
