Merge branch 'develop' into update_212_Dec_merge_with_21125_chamges
[jalview.git] / src / jalview / io / ModellerDescription.java
index e184d74..4976719 100755 (executable)
  */
 package jalview.io;
 
-import jalview.bin.Cache;
 import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.SequenceI;
+import jalview.util.Platform;
+import jalview.bin.Console;
 
 import java.util.List;
 
@@ -96,10 +97,19 @@ public class ModellerDescription
     }
   };
 
+  private static Regex VALIDATION_REGEX;
+
+  private static Regex getRegex()
+  {
+    return (VALIDATION_REGEX == null
+            ? VALIDATION_REGEX = Platform
+                    .newRegex("\\s*((([-0-9]+).?)|FIRST|LAST|@)", null)
+            : VALIDATION_REGEX);
+  }
   private resCode validResidueCode(String field)
   {
     Integer val = null;
-    Regex r = new Regex("\\s*((([-0-9]+).?)|FIRST|LAST|@)");
+    Regex r = getRegex();
 
     if (!r.search(field))
     {
@@ -110,7 +120,7 @@ public class ModellerDescription
     {
       value = r.stringMatched(1);
     }
-    // Cache.debug("from '" + field + "' matched '" + value +
+    // jalview.bin.Console.debug("from '" + field + "' matched '" + value +
     // "'");
     try
     {
@@ -165,7 +175,7 @@ public class ModellerDescription
                 }
                 else
                 {
-                  // Cache.debug(
+                  // jalview.bin.Console.debug(
                   // "Ignoring non-Modeller description: invalid integer-like
                   // field '" + field + "'");
                   type = -1; /* invalid field! - throw the FieldSet away */
@@ -279,14 +289,15 @@ public class ModellerDescription
         List<DBRefEntry> dbr = seq.getDatasetSequence().getDBRefs();
         for (int i = 0, ni = dbr.size(); i < ni; i++)
         {
-          DBRefEntry dbri = dbr.get(i);
+               DBRefEntry dbri = dbr.get(i);
           if (dbri != null)
           {
             // JBPNote PDB dbRefEntry needs properties to propagate onto
             // ModellerField
             // JBPNote Need to get info from the user about whether the sequence
             // is the one being modelled, or if it is a template.
-            if (dbri.getSource().equals(jalview.datamodel.DBRefSource.PDB))
+            if (dbri.getSource()
+                    .equals(jalview.datamodel.DBRefSource.PDB))
             {
               fields.put(Fields[LOCALID], dbri.getAccessionId());
               t = 2;