Merge branch 'feature/JAL-3187linkedFeatures' into feature/JAL-3251biotypedMappings
[jalview.git] / src / jalview / analysis / scoremodels / ScoreModels.java
index 3cbd5f1..ebc9a26 100644 (file)
@@ -41,12 +41,22 @@ public class ScoreModels
 
   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;
   }
 
@@ -139,6 +149,14 @@ public class ScoreModels
   }
 
   /**
+   * 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
    *