JAL-3981 patch tests and remove errant imports
[jalview.git] / src / jalview / io / JPredFile.java
index 451ece8..ab2c00a 100755 (executable)
@@ -25,6 +25,8 @@
  */
 package jalview.io;
 
+import java.util.Locale;
+
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.Sequence;
@@ -68,6 +70,8 @@ public class JPredFile extends AlignFile
   /**
    * Creates a new JPredFile object.
    * 
+   * BH allows File or String
+   * 
    * @param inFile
    *          DOCUMENT ME!
    * @param sourceType
@@ -76,7 +80,7 @@ public class JPredFile extends AlignFile
    * @throws IOException
    *           DOCUMENT ME!
    */
-  public JPredFile(String inFile, DataSourceType sourceType)
+  public JPredFile(Object inFile, DataSourceType sourceType)
           throws IOException
   {
     super(inFile, sourceType);
@@ -207,7 +211,7 @@ public class JPredFile extends AlignFile
           {
             ascore = symbols.nextToken();
 
-            Float score = new Float(ascore);
+            Float score = Float.valueOf(ascore);
             scores.addElement(score);
           }
 
@@ -219,8 +223,8 @@ public class JPredFile extends AlignFile
 
           for (int j = 0; j < i; j++)
           {
-            scores.setElementAt(
-                    ((Float) scores.elementAt(j)).toString(), j);
+            scores.setElementAt(((Float) scores.elementAt(j)).toString(),
+                    j);
           }
 
           scores.addElement(ascore);
@@ -283,7 +287,7 @@ public class JPredFile extends AlignFile
 
           seq_entries.addElement(newseq.toString());
           ids.addElement(id);
-          Symscores.put(id, new Integer(ids.size() - 1));
+          Symscores.put(id, Integer.valueOf(ids.size() - 1));
         }
       }
     }
@@ -299,20 +303,20 @@ public class JPredFile extends AlignFile
     {
       // Add all sequence like objects
       Sequence newSeq = new Sequence(ids.elementAt(i).toString(),
-              seq_entries.elementAt(i).toString(), 1, seq_entries
-                      .elementAt(i).toString().length());
+              seq_entries.elementAt(i).toString(), 1,
+              seq_entries.elementAt(i).toString().length());
 
       if (maxLength != seq_entries.elementAt(i).toString().length())
       {
-        throw new IOException(
-                MessageManager
-                        .formatMessage(
-                                "exception.jpredconcide_entry_has_unexpected_number_of_columns",
-                                new String[] { ids.elementAt(i).toString() }));
+        throw new IOException(MessageManager.formatMessage(
+                "exception.jpredconcide_entry_has_unexpected_number_of_columns",
+                new String[]
+                { ids.elementAt(i).toString() }));
       }
 
-      if ((newSeq.getName().startsWith("QUERY") || newSeq.getName()
-              .startsWith("align;")) && (QuerySeqPosition == -1))
+      if ((newSeq.getName().startsWith("QUERY")
+              || newSeq.getName().startsWith("align;"))
+              && (QuerySeqPosition == -1))
       {
         QuerySeqPosition = seqs.size();
       }
@@ -332,11 +336,10 @@ public class JPredFile extends AlignFile
       } catch (Exception e)
       {
         tal = null;
-        IOException ex = new IOException(
-                MessageManager
-                        .formatMessage(
-                                "exception.couldnt_parse_concise_annotation_for_prediction",
-                                new String[] { e.getMessage() }));
+        IOException ex = new IOException(MessageManager.formatMessage(
+                "exception.couldnt_parse_concise_annotation_for_prediction",
+                new String[]
+                { e.getMessage() }));
         e.printStackTrace(); // java 1.1 does not have :
                              // ex.setStackTrace(e.getStackTrace());
         throw ex;
@@ -356,16 +359,15 @@ public class JPredFile extends AlignFile
    * @return String
    */
   @Override
-  public String print()
+  public String print(SequenceI[] sqs, boolean jvsuffix)
   {
     return "Not Supported";
   }
 
   /**
-   * DOCUMENT ME!
    * 
    * @param args
-   *          DOCUMENT ME!
+   * @j2sIgnore
    */
   public static void main(String[] args)
   {
@@ -409,7 +411,7 @@ public class JPredFile extends AlignFile
     // check that no stray annotations have been added at the end.
     {
       SequenceI sq = seqs.elementAt(j - 1);
-      if (sq.getName().toUpperCase().startsWith("JPRED"))
+      if (sq.getName().toUpperCase(Locale.ROOT).startsWith("JPRED"))
       {
         annotSeqs.addElement(sq);
         seqs.removeElementAt(--j);