diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-24 23:11:37 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-24 23:11:37 +0000 |
| commit | c4ad328e63067bc290c52a92c602220007729a9c (patch) | |
| tree | ebc9e58c72167949ad00352fdcb455f72e7f778b | |
| parent | 7015fbd868d211e5688723e0de9efe933fcb5596 (diff) | |
Cleanup.
| -rw-r--r-- | ROADMAP | 1 | ||||
| -rw-r--r-- | build.xml | 2 | ||||
| -rw-r--r-- | sources/core/VSMessage.java | 8 | ||||
| -rw-r--r-- | sources/core/VSProcess.java | 3 | ||||
| -rw-r--r-- | sources/core/VSTaskManager.java | 17 | ||||
| -rw-r--r-- | sources/prefs/VSDefaultPrefs.java | 17 | ||||
| -rw-r--r-- | sources/prefs/VSPrefs.java | 11 | ||||
| -rw-r--r-- | sources/protocols/VSProtocol.java | 1 | ||||
| -rw-r--r-- | sources/protocols/implementations/InternalTimeSyncProtocol.java | 4 |
9 files changed, 17 insertions, 47 deletions
@@ -1,3 +1,4 @@ +Alle Protokoll und Prozess VSPrefs' mit Einheiten versehen Periodische Tasks anlegen koennen Ganze simulationseinstellungen abspeichern/laden koennen TaskManager + Tasks serialisierbar machen @@ -14,7 +14,7 @@ <target name="compile" depends="init" description="compile the source" > <javac srcdir="${sources}" destdir="${classes}"> - <compilerarg value="-Xlint:deprecation" /> + <compilerarg value="-Xlint:deprecation,unchecked" /> </javac> <copy todir="${classes}/icons"> <fileset dir="icons" /> diff --git a/sources/core/VSMessage.java b/sources/core/VSMessage.java index 95bcc7a..127f314 100644 --- a/sources/core/VSMessage.java +++ b/sources/core/VSMessage.java @@ -7,12 +7,12 @@ import protocols.*; public class VSMessage extends VSPrefs { private String protocolClassname; + private VSPrefs prefs; private VSProcess sendingProcess; + private VSVectorTime vectorTime; + private long lamportTime; private long messageID; private static long messageCounter; - private long lamportTime; - private VSVectorTime vectorTime; - private VSPrefs prefs; public VSMessage(String protocolClassname) { this.protocolClassname = protocolClassname; @@ -72,7 +72,5 @@ public class VSMessage extends VSPrefs { } public void logg(String message) { } - public void onInit() { } - public void onStart() { } } diff --git a/sources/core/VSProcess.java b/sources/core/VSProcess.java index 5612d89..f92898e 100644 --- a/sources/core/VSProcess.java +++ b/sources/core/VSProcess.java @@ -555,7 +555,8 @@ public class VSProcess extends VSPrefs { VSProtocol protocol = null; if (!objectExists(protocolClassname)) { - protocol = (VSProtocol) VSRegisteredEvents.createEventInstanceByClassname(protocolClassname, this); + protocol = (VSProtocol) + VSRegisteredEvents.createEventInstanceByClassname(protocolClassname, this); setObject(protocolClassname, protocol); protocolsToReset.add(protocol); diff --git a/sources/core/VSTaskManager.java b/sources/core/VSTaskManager.java index 6b419cf..a9f3ba3 100644 --- a/sources/core/VSTaskManager.java +++ b/sources/core/VSTaskManager.java @@ -16,28 +16,11 @@ 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); this.fullfilledProgrammedTasks = new LinkedList<VSTask>(); } - /* - private Comparator<VSTask> createComparator() { - return new Comparator<VSTask>() { - public int compare(VSTask a, VSTask b) { - if (a.getTaskTime() > b.getTaskTime()) - return 1; - - if (a.getTaskTime() < b.getTaskTime()) - return -1; - - return 0; - } - }; - } - */ - public synchronized void runTasks(final long step, final long offset, final long lastGlobalTime) { VSTask task = null; VSProcess process = null; diff --git a/sources/prefs/VSDefaultPrefs.java b/sources/prefs/VSDefaultPrefs.java index 3446184..f8dbb2a 100644 --- a/sources/prefs/VSDefaultPrefs.java +++ b/sources/prefs/VSDefaultPrefs.java @@ -10,24 +10,11 @@ public class VSDefaultPrefs extends VSPrefs { } public static VSPrefs init(String fileName) { - File file = new File(fileName); - VSPrefs prefs = null; - - if (file.exists()) { - prefs = openFile(fileName); - - } else { - prefs = new VSDefaultPrefs(); - prefs.fillWithDefaults(); - } - + VSPrefs prefs = new VSDefaultPrefs(); + prefs.fillWithDefaults(); return prefs; } - public void saveFile() { - super.saveFile(VSPrefs.PREFERENCES_FILENAME); - } - public void fillWithDefaults() { super.clear(); fillDefaultBooleans(); diff --git a/sources/prefs/VSPrefs.java b/sources/prefs/VSPrefs.java index 5b2cc9c..4ba0208 100644 --- a/sources/prefs/VSPrefs.java +++ b/sources/prefs/VSPrefs.java @@ -438,7 +438,8 @@ public abstract class VSPrefs implements Serializable { objectOutputStream.writeObject(units); } - 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(); @@ -451,8 +452,8 @@ public abstract class VSPrefs implements Serializable { units = (HashMap<String,String>) objectInputStream.readObject(); } + /* public void saveFile(String filename) { - //System.out.println("SAVE FILE " + filename); try { FileOutputStream fileOutputStream = new FileOutputStream(filename); ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream); @@ -462,12 +463,11 @@ public abstract class VSPrefs implements Serializable { e.printStackTrace(); } } + */ - public void saveFile() { }; - + /* public static VSPrefs openFile(String filename) { VSPrefs prefs = null; - //System.out.println("OPEN FILE " + filename); try { FileInputStream fileInputStream = new FileInputStream(filename); @@ -485,6 +485,7 @@ public abstract class VSPrefs implements Serializable { return prefs; } + */ public void copyIntegers(VSPrefs copyInto, String[] keys) { for (String key : keys) diff --git a/sources/protocols/VSProtocol.java b/sources/protocols/VSProtocol.java index e13fe2e..7b9b9ad 100644 --- a/sources/protocols/VSProtocol.java +++ b/sources/protocols/VSProtocol.java @@ -67,7 +67,6 @@ abstract public class VSProtocol extends VSEvent { } } - abstract protected void onInit(); abstract protected void onClientStart(); abstract protected void onClientReset(); abstract protected void onClientRecv(VSMessage message); diff --git a/sources/protocols/implementations/InternalTimeSyncProtocol.java b/sources/protocols/implementations/InternalTimeSyncProtocol.java index fc26dab..22dd809 100644 --- a/sources/protocols/implementations/InternalTimeSyncProtocol.java +++ b/sources/protocols/implementations/InternalTimeSyncProtocol.java @@ -11,8 +11,8 @@ public class InternalTimeSyncProtocol extends VSProtocol { setClassname(getClass().toString()); /* Those prefs are editable through the VSProtocol VSEditor GUI. t_min and t_max in milliseconds */ - setLong("t_min", 1000); - setLong("t_max", 5000); + setLong("t_min", 500); + setLong("t_max", 2000); } protected void onInit() { |
