Class ParameterDB

Class ParameterDB

java.lang.Object
   |
   +----ParameterDB

class ParameterDB
extends Object
This class contains a Properties object that is used to store all of the parameter names and their corresponding values. It contains a secondary Property object that is initialized with the default values of the parameters as described in Chapter 5 of the lil-gp User's Manual. More importantly, this class contains all of the methods responsible for parsing the parameter values for errors before the output file can be generated. This class also contains a Vector object that is used to store errors encountered while parsing the database. Once the parse is complete, an ErrorFrame is instantiated and the error Vector is passed in.
See Also:
ErrorFrame

Variable Index

 o endl

Constructor Index

 o ParameterDB()
The constructor method is responsible for creating a default Property object and instantiating the main Property object.

Method Index

 o addToDB(String, String)
This method allows external classes to request that a parameter be added to the database.
 o delFromDB(String)
This method allows external classes to request that a parameter be deleted from the database.
 o displayErrors()
This method is responsible for creating the ErrorFrame.
 o dump()
A useful debugging method that dumps the contents of the database
 o getElements()
This method allows external classes to request an Enumeration of the elements in the parameter database.
 o getKeys()
This method allows external classes to request an Enumeration of the keys in the parameter database.
 o getProp(String)
This method allows external classes to request a specific parameter in the database.
 o OLDsave(String)
This method is responsible for generating the output file that will be used as input for lil-gp.
 o open(String)
This method is repsonsible for opening an existing parameter file and reading the contents into a temporary hashtable.
 o parse()
This method simply adds informative comments to the error Vector add calls the appropriate parse methods for each panel.
 o purgeOldPhases()
This method will purge all parameters associated with breeding phases from the database.
 o purgeOldSubPopExchanges()
This method will purge all of the parameters associated with exchanges between sub-populations.
 o purgeOldSubPopParameters()
This method purges the parameters associated with multiple sub-populations, but does not purge the parameters associated with the actual sub-pop exchanges.
 o purgeUserDefinedParameters()
 o save(String)

Variables

 o endl
  public static String endl

Constructors

 o ParameterDB
  public ParameterDB()
The constructor method is responsible for creating a default Property object and instantiating the main Property object.

Methods

 o getKeys
  public Enumeration getKeys()
This method allows external classes to request an Enumeration of the keys in the parameter database.
Returns:
an Enumeration of the keys
 o getElements
  public Enumeration getElements()
This method allows external classes to request an Enumeration of the elements in the parameter database.
Returns:
an Enumeration of the elements
 o getProp
  public String getProp(String key)
This method allows external classes to request a specific parameter in the database.
Parameters:
key - String object containing the desired property key
Returns:
the value associated with key
 o addToDB
  public void addToDB(String name,
                      String value)
This method allows external classes to request that a parameter be added to the database. If the parameter is already in the database, its old value is replaced with the specified value.
Parameters:
name - String object containing the name of the parameter
value - String object containing the value of the parameter.
 o delFromDB
  public void delFromDB(String name)
This method allows external classes to request that a parameter be deleted from the database.
Parameters:
name - String object containing the name of the parameter
 o purgeOldPhases
  public void purgeOldPhases()
This method will purge all parameters associated with breeding phases from the database. It is called when the user clicks on the 'purge' button on the BreedingPanel and before adding new breed phase parameters when the user clicks the 'accept' button.
 o purgeOldSubPopExchanges
  public void purgeOldSubPopExchanges()
This method will purge all of the parameters associated with exchanges between sub-populations. It does not remove the following parameters: It is called when the user clicks on the 'purge' button on the SubPopsPanel and also before new exchanges are added to the database.
See Also:
purgeOldSubPopParameters
 o purgeUserDefinedParameters
  public void purgeUserDefinedParameters()
 o purgeOldSubPopParameters
  public void purgeOldSubPopParameters()
This method purges the parameters associated with multiple sub-populations, but does not purge the parameters associated with the actual sub-pop exchanges. It is called when the user clicks on the 'purge' button and before new sub-pop parameters are added to the database.
See Also:
purgeOldSubPopExchanges
 o OLDsave
  public void OLDsave(String filename) throws IOException
This method is responsible for generating the output file that will be used as input for lil-gp. Before generating the file, it parses the parameters for errors. If there are no errors, a FileOutputStream is created and the file is generated. The parameters are grouped in the file by category and comments are inserted to help make it readable.
Parameters:
filename - String object containing the name of the output file
See Also:
parse
 o save
  public void save(String filename) throws IOException
 o open
  public void open(String filename) throws IOException
This method is repsonsible for opening an existing parameter file and reading the contents into a temporary hashtable. If it encounters any unexpected errors in the parameter file, it will abort the open process. That is, it will leave the current settings on all of the panels intact and show the user where the error occurred. If there are no sytax errors in the file, then the parameters are run through the parse() method. If there are no errors in the parameter settings, then the loadParams() method is called for each panel.
Parameters:
filename - the name of the input file
See Also:
loadParams, loadParams, loadParams, loadParams, loadParams, loadParams, loadParams, loadParams
 o dump
  public void dump()
A useful debugging method that dumps the contents of the database
 o displayErrors
  public void displayErrors()
This method is responsible for creating the ErrorFrame.
See Also:
ErrorFrame, addComment, addWarning, addError
 o parse
  public boolean parse()
This method simply adds informative comments to the error Vector add calls the appropriate parse methods for each panel. If there were any errors or warnings encountered while parsing the parameters, then return false.
Returns:
true if there were no errors or warnings, else return false
See Also:
parseGeneralPanel, parseOutputPanel, parseLimitsPanel, parseInitPanel, parseBreedingPanel, parseSubPopsPanel