How to add new approximative formulas

1) Creates a new class which implements the MeltingComputationMethod interface or which extends the ApproximativeMode class in the melting.approximativeMethods package.

The ApproximativeMode class already implements the public functions RegisterMethods getRegister() and void setUpVariables(HashMap<String, String> options) of the MeltingComputationMethod interface. This last method is useful to compute an equivalent sodium concentration if other cations than sodium are entered by the user.

If you extend the ApproximativeMode class, you just need to implement the public functions ThermoResult computesThermodynamics() and boolean isApplicable() of the MeltingComputationMethod interface. These methods are respectively important to compute the melting temperature with the approximative formula and to define the conditions of application of this formula. (read the Javadoc for further information). You also can override the different ApproximativeMode methods.

If you don't extend the ApproximativeMode class, you have to implement all the MeltingComputationMethod methods. (RegisterMethods getRegister(), void setUpVariables(HashMap<String, String> options), ThermoResult computesThermodynamics() and boolean isApplicable()).

Don't forget to add a private static String as instance variable of the class. This String must represent the approximative formula and must be printed when the verbose mode is required by the user (see the following example).

// Create a private static String which represents the 
// approximative formula
private static String temperatureFormula = "formula";

[...]

public ThermoResult computesThermodynamics(){

// To print the article reference of the approximative 
// formula if the verbose mode is required.
OptionManagement.meltingLogger.log(Level.FINE, "from 
                                Ahsen et al. (2001)");

// To print the approximative formula (the private 
 // static String)
OptionManagement.meltingLogger.log(Level.FINE, 
                                  temperatureFormula);

[...]
}

2) Register the approximative formula name and the class which represents it in the RegisterMethods class (melting.configuration package). You have to add in the function private void initialiseApproximativeMethods() of RegisterMethods this following line :

private void initialiseApproximativeMethods(){
		[...]
		
		// To map the formula name to the class which 
		// implements it.
        approximativeMethod.put("formula-Name", 
                                  ClassName.class);
	}

Computational Neurobiology 2009-08-24