From 378c2674fc704b2a6bbf0e6a01b721a7aea7c2e2 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 2 Jun 2008 00:21:43 +0000 Subject: saveing seems work, but may have bugs --- sources/serialize/VSSerialize.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'sources/serialize/VSSerialize.java') diff --git a/sources/serialize/VSSerialize.java b/sources/serialize/VSSerialize.java index b659879..20023c9 100644 --- a/sources/serialize/VSSerialize.java +++ b/sources/serialize/VSSerialize.java @@ -82,6 +82,9 @@ public final class VSSerialize { * @param object The object itself */ public void setObject(String key, Object object) { + if (DEBUG) + System.out.println("setObject("+key+")"); + objects.put(key, object); } @@ -93,9 +96,24 @@ public final class VSSerialize { * @param object The object itself */ public void setObject(int num, String key, Object object) { + if (DEBUG) + System.out.println("setObject("+key+":"+num+")"); + objects.put(key + ":" + num, object); } + /** + * Checks if an object exists. + * + * @param num The object number + * @param key The object key + * + * @return true, if the object exists. false, if the object does not exist + */ + public boolean objectExists(int num, String key) { + return null != objects.get(key + ":" + num); + } + /** * Gets an object. * @@ -153,6 +171,9 @@ public final class VSSerialize { } catch (IOException e) { e.printStackTrace(); + + } finally { + //objectOutputStream.close(); } } @@ -167,6 +188,7 @@ public final class VSSerialize { public VSSimulator openSimulator(String filename, VSSimulatorFrame simulatorFrame) { VSSimulator simulator = null; + simulatorFrame.resetCurrentSimulator(); try { FileInputStream fileInputStream = @@ -183,6 +205,9 @@ public final class VSSerialize { } catch (Exception e) { e.printStackTrace(); + + } finally { + //objectInputStream.close(); } return simulator; -- cgit v1.2.3