diff options
| author | Paul Buetow <paul@buetow.org> | 2008-06-02 00:21:43 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-06-02 00:21:43 +0000 |
| commit | 378c2674fc704b2a6bbf0e6a01b721a7aea7c2e2 (patch) | |
| tree | ae228c2fb8c1387d2667322f60a649032c52c152 /sources/core | |
| parent | a24f52761a623afa3c041b7823004952d8c5286e (diff) | |
saveing seems work, but may have bugs
Diffstat (limited to 'sources/core')
| -rw-r--r-- | sources/core/VSProcess.java | 2 | ||||
| -rw-r--r-- | sources/core/VSTask.java | 19 | ||||
| -rw-r--r-- | sources/core/VSTaskManager.java | 8 |
3 files changed, 19 insertions, 10 deletions
diff --git a/sources/core/VSProcess.java b/sources/core/VSProcess.java index bf4fa98..1b88fc0 100644 --- a/sources/core/VSProcess.java +++ b/sources/core/VSProcess.java @@ -214,7 +214,7 @@ public class VSProcess extends VSPrefs implements VSSerializable { private void init(VSPrefs prefs, int processNum, VSSimulatorCanvas simulatorCanvas, VSLogging logging) { /* May be not null if called from deserialization */ - if (protocolsToReset == null) + if (this.protocolsToReset == null) this.protocolsToReset = new ArrayList<VSAbstractProtocol>(); this.processNum = processNum; this.prefs = prefs; diff --git a/sources/core/VSTask.java b/sources/core/VSTask.java index a903868..1b8f744 100644 --- a/sources/core/VSTask.java +++ b/sources/core/VSTask.java @@ -119,7 +119,7 @@ public class VSTask implements Comparable, VSSerializable { this.process = process; this.taskTime = taskTime > 0 ? taskTime : 0; /* May be not null if called from deserialization */ - if (event == null) + if (this.event == null) this.event = event; this.prefs = process.getPrefs(); this.isGlobalTimed = !isLocal; @@ -286,6 +286,11 @@ public class VSTask implements Comparable, VSSerializable { buffer.append(event.toString()); buffer.append("; PID: "); buffer.append(process.getProcessID()); + /* + if (isProgrammed()) { + buffer.append("; Programmed"); + } + */ return buffer.toString(); } @@ -385,25 +390,27 @@ public class VSTask implements Comparable, VSSerializable { String eventClassname = (String) objectInputStream.readObject(); int eventID = ((Integer) objectInputStream.readObject()).intValue(); - VSAbstractEvent event = (VSAbstractEvent) - serialize.getObject(eventID, "event"); + VSAbstractEvent event = null; + + if (serialize.objectExists(eventID, "event")) { + event = (VSAbstractEvent) serialize.getObject(eventID, "event"); - if (event == null) { + } else { event = VSRegisteredEvents. createEventInstanceByClassname(eventClassname, process); serialize.setObject(eventID, "event", event); } + event.deserialize(serialize, objectInputStream); + int taskNum = ((Integer) objectInputStream.readObject()).intValue(); long taskTime = ((Long) objectInputStream.readObject()).longValue(); Boolean isGlobalTimed = (Boolean) objectInputStream.readObject(); Boolean isProgrammed = (Boolean) objectInputStream.readObject(); serialize.setObject(taskNum, "task", this); - init(taskTime, process, event, !isGlobalTimed.booleanValue()); - this.isProgrammed = isProgrammed.booleanValue(); } } diff --git a/sources/core/VSTaskManager.java b/sources/core/VSTaskManager.java index cbbde56..5e32183 100644 --- a/sources/core/VSTaskManager.java +++ b/sources/core/VSTaskManager.java @@ -537,7 +537,6 @@ public class VSTaskManager implements VSSerializable { if (VSSerialize.DEBUG) System.out.println("Deserializing: VSTaskManager"); - int numTasks = ((Integer) objectInputStream.readObject()).intValue(); globalTasks.clear(); ArrayList<VSProcess> processes = simulatorCanvas.getProcesses(); @@ -546,7 +545,10 @@ public class VSTaskManager implements VSSerializable { process.getTasks().clear(); } - for (int i = 0; i < numTasks; ++i) - addTask(new VSTask(serialize, objectInputStream)); + int numTasks = ((Integer) objectInputStream.readObject()).intValue(); + for (int i = 0; i < numTasks; ++i) { + VSTask task = new VSTask(serialize, objectInputStream); + addTask(task, task.isProgrammed()); + } } } |
