org.opensha.sra.gui.portfolioeal
Class ParameterParser

java.lang.Object
  extended by org.opensha.sra.gui.portfolioeal.ParameterParser

public class ParameterParser
extends Object

This class is used to parse the parameters from a csv portfolio file. If you wish to use different parameters than what are already supported, all you have to do is add the string name of the parameter to the appropriate enum. If you wish to add a new parameter type, you need to create a new enum type, and follow the template of the other array creations. This should be changed in the future to allow for easier code updating. The enum values correspond to the type of parameter that should be created. This class is a singleton, so that the creation of the arrays only has to occur once, which could end up being a lengthy process with many enum values.

Author:
Jeremy Leakakos

Method Summary
static ParameterParser getParameterParser()
          The singleton method.
 String getParameterType(String paramName)
          This method looks through the arrays created from the enum values, and tries to match the paramName to it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getParameterType

public String getParameterType(String paramName)
This method looks through the arrays created from the enum values, and tries to match the paramName to it. If a match occurs, it returns the appropriate parameter type as a string. It goes through each array created at initialization time, from the longest to the shortest. If you add a new parameter type, you need to add a new for loop in the code. It should iterate over the new string representation array created in the constructor, and return the proper string name of the new parameter. It is recommended to put the parameter type that will be used the most first, as it is more likely to be used, and the method will return sooner.

Parameters:
paramName - The name of the parameter to find the type of.
Returns:
The parameter type. This will be the string name of the parameter, or null. The string name will be used to dynamically create a parameter object.

getParameterParser

public static ParameterParser getParameterParser()
The singleton method. This returns the single instance of ParameterParser, or if it is null, creates a new one.

Returns:
The singleton instance of ParameterParser