JAL-1114 - refactor methods handling Vectors and Hashtables to Lists and Maps, and...
[jalview.git] / src / jalview / io / AnnotationFile.java
index 5266d08..b3b2111 100755 (executable)
@@ -68,14 +68,14 @@ public class AnnotationFile
    * columns or hidden row keywords.\r
    * \r
    * @param annotations\r
-   * @param groups\r
+   * @param list\r
    * @param properties\r
    * @return feature file as a string.\r
    */\r
   public String printAnnotations(AlignmentAnnotation[] annotations,\r
-          Vector groups, Hashtable properties)\r
+          List<SequenceGroup> list, Hashtable properties)\r
   {\r
-    return printAnnotations(annotations, groups, properties, null);\r
+    return printAnnotations(annotations, list, properties, null);\r
 \r
   }\r
 \r
@@ -110,13 +110,13 @@ public class AnnotationFile
    * properties and views.\r
    * \r
    * @param annotations\r
-   * @param groups\r
+   * @param list\r
    * @param properties\r
    * @param views\r
    * @return annotation file\r
    */\r
   public String printAnnotations(AlignmentAnnotation[] annotations,\r
-          Vector groups, Hashtable properties, ViewDef[] views)\r
+          List<SequenceGroup> list, Hashtable properties, ViewDef[] views)\r
   {\r
     // TODO: resolve views issue : annotationFile could contain visible region,\r
     // or full data + hidden region specifications for a view.\r
@@ -393,9 +393,9 @@ public class AnnotationFile
       text.append(rowprops.toString());\r
     }\r
 \r
-    if (groups != null)\r
+    if (list != null)\r
     {\r
-      printGroups(groups);\r
+      printGroups(list);\r
     }\r
 \r
     if (properties != null)\r
@@ -419,13 +419,11 @@ public class AnnotationFile
     return text.toString();\r
   }\r
 \r
-  public void printGroups(Vector sequenceGroups)\r
+  public void printGroups(List<SequenceGroup> list)\r
   {\r
-    SequenceGroup sg;\r
     SequenceI seqrep = null;\r
-    for (int i = 0; i < sequenceGroups.size(); i++)\r
+    for (SequenceGroup sg:list)\r
     {\r
-      sg = (SequenceGroup) sequenceGroups.elementAt(i);\r
       if (!sg.hasSeqrep())\r
       {\r
         text.append("SEQUENCE_GROUP\t" + sg.getName() + "\t"\r
@@ -889,17 +887,14 @@ public class AnnotationFile
       }\r
       // Finally, resolve the groupRefs\r
       Enumeration en = groupRefRows.keys();\r
-      SequenceGroup theGroup = null;\r
-\r
+      \r
       while (en.hasMoreElements())\r
       {\r
         groupRef = (String) en.nextElement();\r
         boolean matched = false;\r
         // Resolve group: TODO: add a getGroupByName method to alignments\r
-        Vector grps = al.getGroups();\r
-        for (int g = 0, gSize = grps.size(); g < gSize; g++)\r
+        for (SequenceGroup theGroup : al.getGroups())\r
         {\r
-          theGroup = (SequenceGroup) grps.elementAt(g);\r
           if (theGroup.getName().equals(groupRef))\r
           {\r
             if (matched)\r
@@ -1293,15 +1288,12 @@ public class AnnotationFile
     {\r
       return;\r
     }\r
-    SequenceGroup sg = null;\r
-\r
+    \r
     String name = st.nextToken();\r
-\r
-    Vector groups = al.getGroups();\r
-    for (int i = 0; i < groups.size(); i++)\r
+    SequenceGroup sg=null;\r
+    for (SequenceGroup _sg:al.getGroups())\r
     {\r
-      sg = (SequenceGroup) groups.elementAt(i);\r
-      if (sg.getName().equals(name))\r
+      if ((sg=_sg).getName().equals(name))\r
       {\r
         break;\r
       }\r