private final ScoreMatrix DNA;
- private static ScoreModels instance = new ScoreModels();
+ private static ScoreModels instance;
private Map<String, ScoreModelI> models;
+ /**
+ * Answers the singleton instance of this class, with lazy initialisation
+ * (built-in score models are loaded on the first call to this method)
+ *
+ * @return
+ */
public static ScoreModels getInstance()
{
+ if (instance == null)
+ {
+ instance = new ScoreModels();
+ }
return instance;
}
}
/**
+ * Resets to just the built-in score models
+ */
+ public void reset()
+ {
+ instance = new ScoreModels();
+ }
+
+ /**
* Returns the default peptide or nucleotide score model, currently BLOSUM62
* or DNA
*
import java.io.IOException;
import java.net.MalformedURLException;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
public class ScoreMatrixFileTest
{
+ @AfterMethod(alwaysRun=true)
+ public void tearDownAfterTest()
+ {
+ ScoreModels.getInstance().reset();
+ }
+
/**
* Test a successful parse of a (small) score matrix file
*