chordDiagrams
Class ConfigutaionHolder

java.lang.Object
  extended by chordDiagrams.ConfigutaionHolder
Direct Known Subclasses:
UnframedDiagramGenerator

public abstract class ConfigutaionHolder
extends java.lang.Object

This class is to provide an easy way to access lists of diagrams. This allows to save computation time by not-recomputing known lists.

Author:
Romwell

Field Summary
 java.util.HashMap<java.lang.String,diagram> configs
          File with diagrams
 
Constructor Summary
ConfigutaionHolder()
           
 
Method Summary
abstract  java.lang.String getFileName()
          Generates a filename to store the diagram list into.
 boolean isNew(diagram a)
          checks whether a given configuration is new, i.e.
 boolean loadConfigs()
          Load the diagram data from file.
static java.lang.Object loadObject(java.lang.String fname)
          Attempts to load an Object from file.
 boolean saveConfigs()
          Saves the daigrams (i.e., the configs arraylist) to the file The filename is given by getFileName() function and is determined by n and k.
static boolean saveObject(java.lang.Object obj, java.lang.String fname)
          Saves an object to file to a file with a given filename
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

configs

public java.util.HashMap<java.lang.String,diagram> configs
File with diagrams

Constructor Detail

ConfigutaionHolder

public ConfigutaionHolder()
Method Detail

saveConfigs

public boolean saveConfigs()
Saves the daigrams (i.e., the configs arraylist) to the file The filename is given by getFileName() function and is determined by n and k.

Returns:
true if the diagram data was saved successfully

loadConfigs

public boolean loadConfigs()
Load the diagram data from file. The filename is given by getFileName() function and is determined by n and k.

Returns:
true if the diagrams were loaded successfully

isNew

public boolean isNew(diagram a)
checks whether a given configuration is new, i.e. not in the list

Parameters:
a - the diagram to check for presence in the list of diagrams

getFileName

public abstract java.lang.String getFileName()
Generates a filename to store the diagram list into. Must be overriden in subsequent implementations to provide different file names for different type of lists.

Returns:
digram list filename

loadObject

public static java.lang.Object loadObject(java.lang.String fname)
Attempts to load an Object from file. NOTE: It is your responsibility to make sure that the Object implements Serializable, that you are loading the correct class, etc.

Parameters:
fname - Filename to load the object from
Returns:
the object, if it was loaded successfully; null otherwise

saveObject

public static boolean saveObject(java.lang.Object obj,
                                 java.lang.String fname)
Saves an object to file to a file with a given filename

Parameters:
obj - The object to save to a file
fname - The filename to save to
Returns:
true, if the object was saved successfully; false otherwise