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;
}
return sm;
} catch (IOException e)
{
- System.err.println(
+ jalview.bin.Console.errPrintln(
"Error reading " + resourcePath + ": " + e.getMessage());
}
return null;
ScoreModelI sm2 = models.get(sm.getName());
if (sm2 != null)
{
- System.err.println("Warning: replacing score model " + sm2.getName());
+ jalview.bin.Console.errPrintln("Warning: replacing score model " + sm2.getName());
}
models.put(sm.getName(), sm);
}
/**
+ * 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
*