summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.xml19
-rw-r--r--sources/core/VSTask.java16
-rw-r--r--sources/prefs/VSPrefs.java6
-rw-r--r--sources/prefs/VSPrefsRestriction.java61
4 files changed, 80 insertions, 22 deletions
diff --git a/build.xml b/build.xml
index 4a2e296..6487c16 100644
--- a/build.xml
+++ b/build.xml
@@ -50,11 +50,16 @@
<target name="testdist" depends="dist,rundist" />
- <target name="test" depends="compile,run" />
- <target name="javadoc" description="Generate Javadocs">
- <mkdir dir="${basedir}/javadoc/"/>
- <javadoc destdir="${basedir}/javadoc/">
- <fileset dir="${basedir}/" includes="**/*.java" />
- </javadoc>
- </target>
+ <target name="test" depends="compile">
+ <java dir="${classes}" classname="simulator.VSMain" fork="true">
+ <!-- <arg value="-debug" /> -->
+ </java>
+ </target>
+
+ <target name="javadoc" description="Generate Javadocs">
+ <mkdir dir="${basedir}/javadoc/"/>
+ <javadoc destdir="${basedir}/javadoc/">
+ <fileset dir="${basedir}/" includes="**/*.java" />
+ </javadoc>
+ </target>
</project>
diff --git a/sources/core/VSTask.java b/sources/core/VSTask.java
index d5e4274..13f9c01 100644
--- a/sources/core/VSTask.java
+++ b/sources/core/VSTask.java
@@ -317,9 +317,6 @@ public class VSTask implements Comparable, VSSerializable {
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
public int compareTo(Object object) {
- if (object == null)
- return 0;
-
if (object instanceof VSTask) {
final VSTask task = (VSTask) object;
@@ -331,9 +328,6 @@ public class VSTask implements Comparable, VSSerializable {
VSAbstractEvent event2 = task.getEvent();
- if (event2 == null || event == null)
- return 0;
-
/* If it's a recovering, it should get handled very first */
boolean a = event instanceof VSProcessRecoverEvent;
boolean b = event2 instanceof VSProcessRecoverEvent;
@@ -373,7 +367,15 @@ public class VSTask implements Comparable, VSSerializable {
if (b)
return 1;
- return event.getShortname().compareTo(event2.getShortname());
+ String shortname = event.getShortname();
+ String shortname2 = event2.getShortname();
+
+ /* One of those may be null if an VSAbstractEvent object has not
+ been initialized yet */
+ if (shortname == null || shortname2 == null)
+ return 0;
+
+ return shortname.compareTo(shortname2);
}
return 0;
diff --git a/sources/prefs/VSPrefs.java b/sources/prefs/VSPrefs.java
index 1746e32..15f8874 100644
--- a/sources/prefs/VSPrefs.java
+++ b/sources/prefs/VSPrefs.java
@@ -1063,11 +1063,11 @@ public class VSPrefs implements VSSerializable {
*/
public void copyColors(VSPrefs copyInto, String[] keys) {
for (String key : keys) {
- Color color = getColor(key);
- float comp[] = color.getComponents(null);
+ Color color = getColor(key);
+ float comp[] = color.getComponents(null);
copyInto.initColor(key, new Color(comp[0], comp[1], comp[2]),
getDescription(COLOR_PREFIX + key));
- }
+ }
}
/**
diff --git a/sources/prefs/VSPrefsRestriction.java b/sources/prefs/VSPrefsRestriction.java
index f66246c..32ab213 100644
--- a/sources/prefs/VSPrefsRestriction.java
+++ b/sources/prefs/VSPrefsRestriction.java
@@ -23,20 +23,20 @@
package prefs;
-import java.io.Serializable;
+import java.io.*;
import java.util.Vector;
/**
* The class VSPrefsRestriction.
*/
-public class VSPrefsRestriction implements Serializable {
- private static final long serialVersionUID = 1L;
+abstract public class VSPrefsRestriction implements Serializable {
+ private static final long serialVersionUID = 2L;
/**
* The class VSIntegerPrefsRestriction.
*/
public static class VSIntegerPrefsRestriction extends VSPrefsRestriction {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
/** The min value. */
private int minValue;
@@ -71,13 +71,31 @@ public class VSPrefsRestriction implements Serializable {
public int getMaxValue() {
return maxValue;
}
+
+ /* (non-Javadoc)
+ * @see prefs.VSPrefsRestriction#writeObject(java.io.ObjectOutputStream)
+ */
+ public void writeObject(ObjectOutputStream out)
+ throws IOException {
+ out.writeObject(new Integer(minValue));
+ out.writeObject(new Integer(maxValue));
+ }
+
+ /* (non-Javadoc)
+ * @see prefs.VSPrefsRestriction#readObject(java.io.ObjectInputStream)
+ */
+ public void readObject(ObjectInputStream in)
+ throws IOException, ClassNotFoundException {
+ minValue = ((Integer) in.readObject()).intValue();
+ maxValue = ((Integer) in.readObject()).intValue();
+ }
}
/**
* The class VSStringPrefsRestriction.
*/
public static class VSStringPrefsRestriction extends VSPrefsRestriction {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
/** The possible selections. */
Vector<String> possibleSelections;
@@ -102,5 +120,38 @@ public class VSPrefsRestriction implements Serializable {
public Vector<String> getPossibleSelections() {
return possibleSelections;
}
+
+ /* (non-Javadoc)
+ * @see prefs.VSPrefsRestriction#writeObject(java.io.ObjectOutputStream)
+ */
+ public void writeObject(ObjectOutputStream out)
+ throws IOException {
+ out.writeObject(possibleSelections);
+ }
+
+ /* (non-Javadoc)
+ * @see prefs.VSPrefsRestriction#readObject(java.io.ObjectInputStream)
+ */
+ @SuppressWarnings("unchecked")
+ public void readObject(ObjectInputStream in)
+ throws IOException, ClassNotFoundException {
+ possibleSelections = (Vector<String>) in.readObject();
+ }
}
+
+ /**
+ * Serializes the object.
+ *
+ * @param out The output stream
+ */
+ abstract public void writeObject(ObjectOutputStream out)
+ throws IOException;
+
+ /**
+ * Deserializes the object.
+ *
+ * @param in The input stream
+ */
+ abstract public void readObject(ObjectInputStream in)
+ throws IOException, ClassNotFoundException;
}