JAL-3253 temporary branch SwingJS upgrade with testNG fixes Java 8
[jalview.git] / src / jalview / io / TCoffeeScoreFile.java
index 648954f..d069e5e 100644 (file)
@@ -109,7 +109,7 @@ public class TCoffeeScoreFile extends AlignFile
 
   public final static String TCOFFEE_SCORE = "TCoffeeScore";
 
-  static Pattern SCORES_WITH_RESIDUE_NUMS = Pattern
+  private final static Pattern SCORES_WITH_RESIDUE_NUMS = Pattern
           .compile("^\\d+\\s([^\\s]+)\\s+\\d+$");
 
   /** The {@link Header} structure holder */
@@ -123,9 +123,10 @@ public class TCoffeeScoreFile extends AlignFile
 
   Integer fWidth;
 
-  public TCoffeeScoreFile(String inFile, DataSourceType fileSourceType)
+  public TCoffeeScoreFile(Object inFile, DataSourceType fileSourceType)
           throws IOException
   {
+    // BH 2018 allows File or String
     super(inFile, fileSourceType);
 
   }
@@ -182,8 +183,9 @@ public class TCoffeeScoreFile extends AlignFile
    */
   public String getScoresFor(String id)
   {
-    return scores != null && scores.containsKey(id) ? scores.get(id)
-            .toString() : "";
+    return scores != null && scores.containsKey(id)
+            ? scores.get(id).toString()
+            : "";
   }
 
   /**
@@ -196,7 +198,7 @@ public class TCoffeeScoreFile extends AlignFile
     {
       return null;
     }
-    List<String> result = new ArrayList<String>(scores.size());
+    List<String> result = new ArrayList<>(scores.size());
     for (Map.Entry<String, StringBuilder> it : scores.entrySet())
     {
       result.add(it.getValue().toString());
@@ -248,7 +250,7 @@ public class TCoffeeScoreFile extends AlignFile
       error = true;
       return;
     }
-    scores = new LinkedHashMap<String, StringBuilder>();
+    scores = new LinkedHashMap<>();
 
     /*
      * initilize the structure
@@ -274,9 +276,9 @@ public class TCoffeeScoreFile extends AlignFile
         if (scoreStringBuilder == null)
         {
           error = true;
-          errormessage = String
-                  .format("Invalid T-Coffee score file: Sequence ID '%s' is not declared in header section",
-                          entry.getKey());
+          errormessage = String.format(
+                  "Invalid T-Coffee score file: Sequence ID '%s' is not declared in header section",
+                  entry.getKey());
           return;
         }
 
@@ -501,7 +503,7 @@ public class TCoffeeScoreFile extends AlignFile
 
     int score;
 
-    LinkedHashMap<String, Integer> scores = new LinkedHashMap<String, Integer>();
+    LinkedHashMap<String, Integer> scores = new LinkedHashMap<>();
 
     public int getScoreAvg()
     {
@@ -528,7 +530,7 @@ public class TCoffeeScoreFile extends AlignFile
     public Block(int size)
     {
       this.size = size;
-      this.items = new HashMap<String, String>(size);
+      this.items = new HashMap<>(size);
     }
 
     String getScoresFor(String id)
@@ -584,9 +586,9 @@ public class TCoffeeScoreFile extends AlignFile
       i++;
       if (s == null && i != scores.size() && !id.getKey().equals("cons"))
       {
-        System.err.println("No "
-                + (matchids ? "match " : " sequences left ")
-                + " for TCoffee score set : " + id.getKey());
+        System.err
+                .println("No " + (matchids ? "match " : " sequences left ")
+                        + " for TCoffee score set : " + id.getKey());
         continue;
       }
       int jSize = al.getWidth() < srow.length ? al.getWidth() : srow.length;
@@ -599,16 +601,16 @@ public class TCoffeeScoreFile extends AlignFile
           annotations[j] = null;
           if (val > 0)
           {
-            System.err
-                    .println("Warning: non-zero value for positional T-COFFEE score for gap at "
+            System.err.println(
+                    "Warning: non-zero value for positional T-COFFEE score for gap at "
                             + j + " in sequence " + s.getName());
           }
         }
         else
         {
           annotations[j] = new Annotation(s == null ? "" + val : null,
-                  s == null ? "" + val : null, '\0', val * 1f, val >= 0
-                          && val < colors.length ? colors[val]
+                  s == null ? "" + val : null, '\0', val * 1f,
+                  val >= 0 && val < colors.length ? colors[val]
                           : Color.white);
         }
       }