serialize
Class VSSerialize

java.lang.Object
  extended by serialize.VSSerialize

public final class VSSerialize
extends java.lang.Object

The class VSSerialize, this class helps do serialize/deserialize a saved simulator!

Author:
Paul C. Buetow

Field Summary
static boolean DEBUG
          True if debug mode of serialization/deserialization
static java.lang.String LAST_FILENAME
          The last filename used for saveing/opening
 
Constructor Summary
VSSerialize()
          Creates the VSSerialize object.
 
Method Summary
 java.lang.Object getObject(int num, java.lang.String key)
          Gets an object.
 java.lang.Object getObject(java.lang.String key)
          Gets an object.
static VSSerialize getSerialize()
          Gets the current VSSerialize object.
 boolean objectExists(int num, java.lang.String key)
          Checks if an object exists.
 VSSimulator openSimulator(java.lang.String filename, VSSimulatorFrame simulatorFrame)
          Opens a simulator from the given filename.
 VSSimulator openSimulator(VSSimulatorFrame simulatorFrame)
          Opens a simulator from a file selected from a file chooser.
 void saveSimulator(java.lang.String filename, VSSimulator simulator)
          Saves the given simulator to the given filename.
 void saveSimulator(VSSimulator simulator)
          Saves the given simulator to a file choosen by the file chooser.
 void setObject(int num, java.lang.String key, java.lang.Object object)
          Sets an object.
 void setObject(java.lang.String key, java.lang.Object object)
          Sets an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
True if debug mode of serialization/deserialization

See Also:
Constant Field Values

LAST_FILENAME

public static java.lang.String LAST_FILENAME
The last filename used for saveing/opening

Constructor Detail

VSSerialize

public VSSerialize()
Creates the VSSerialize object.

Method Detail

getSerialize

public static VSSerialize getSerialize()
Gets the current VSSerialize object.

Returns:
The current serialize object

setObject

public void setObject(java.lang.String key,
                      java.lang.Object object)
Sets an object.

Parameters:
key - The object key
object - The object itself

setObject

public void setObject(int num,
                      java.lang.String key,
                      java.lang.Object object)
Sets an object.

Parameters:
num - The object number
key - The object key
object - The object itself

objectExists

public boolean objectExists(int num,
                            java.lang.String key)
Checks if an object exists.

Parameters:
num - The object number
key - The object key
Returns:
true, if the object exists. false, if the object does not exist

getObject

public java.lang.Object getObject(int num,
                                  java.lang.String key)
Gets an object.

Parameters:
num - The object number
key - The object key
Returns:
The object itself

getObject

public java.lang.Object getObject(java.lang.String key)
Gets an object.

Parameters:
key - The object key
Returns:
The object itself

saveSimulator

public void saveSimulator(java.lang.String filename,
                          VSSimulator simulator)
Saves the given simulator to the given filename.

Parameters:
filename - The filename
simulator - The simulator

saveSimulator

public void saveSimulator(VSSimulator simulator)
Saves the given simulator to a file choosen by the file chooser.

Parameters:
simulator - The simulator

openSimulator

public VSSimulator openSimulator(java.lang.String filename,
                                 VSSimulatorFrame simulatorFrame)
Opens a simulator from the given filename.

Parameters:
filename - The filename.
simulatorFrame - The simulator frame
Returns:
The simulator object, and null if no success

openSimulator

public VSSimulator openSimulator(VSSimulatorFrame simulatorFrame)
Opens a simulator from a file selected from a file chooser.

Parameters:
simulatorFrame - The simulator frame
Returns:
The simulator object, and null if no success