JAL-1114 - refactor methods handling Vectors and Hashtables to Lists and Maps, and...
[jalview.git] / src / jalview / appletgui / SeqPanel.java
index f121d11..b9c5cf0 100644 (file)
@@ -287,7 +287,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
       else
       {
         // Now add any sequences between min and max
-        sg.getSequences(null).removeAllElements();
+        sg.clear();
         for (int i = min; i < max; i++)
         {
           sg.addSequence(av.getAlignment().getSequenceAt(i), false);
@@ -1036,13 +1036,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
 
     if (groupEditing)
     {
-      Vector vseqs = sg.getSequences(av.getHiddenRepSequences());
-      int g, groupSize = vseqs.size();
-      SequenceI[] groupSeqs = new SequenceI[groupSize];
-      for (g = 0; g < groupSeqs.length; g++)
-      {
-        groupSeqs[g] = (SequenceI) vseqs.elementAt(g);
-      }
+      SequenceI[] groupSeqs = sg.getSequences(av.getHiddenRepSequences()).toArray(new SequenceI[0]);
 
       // drag to right
       if (insertGap)
@@ -1064,11 +1058,11 @@ public class SeqPanel extends Panel implements MouseMotionListener,
         {
           blank = true;
 
-          for (g = 0; g < groupSize; g++)
+          for (SequenceI gs:groupSeqs)
           {
             for (int j = 0; j < startres - lastres; j++)
             {
-              if (!jalview.util.Comparison.isGap(groupSeqs[g]
+              if (!jalview.util.Comparison.isGap(gs
                       .getCharAt(fixedRight - j)))
               {
                 blank = false;
@@ -1121,16 +1115,16 @@ public class SeqPanel extends Panel implements MouseMotionListener,
         // / Are we able to delete?
         // ie are all columns blank?
 
-        for (g = 0; g < groupSize; g++)
+        for (SequenceI gs:groupSeqs)
         {
           for (int j = startres; j < lastres; j++)
           {
-            if (groupSeqs[g].getLength() <= j)
+            if (gs.getLength() <= j)
             {
               continue;
             }
 
-            if (!jalview.util.Comparison.isGap(groupSeqs[g].getCharAt(j)))
+            if (!jalview.util.Comparison.isGap(gs.getCharAt(j)))
             {
               // Not a gap, block edit not valid
               endEditing();
@@ -1421,9 +1415,8 @@ public class SeqPanel extends Panel implements MouseMotionListener,
     {
       if (stretchGroup.cs instanceof ClustalxColourScheme)
       {
-        ((ClustalxColourScheme) stretchGroup.cs).resetClustalX(
-                stretchGroup.getSequences(av.getHiddenRepSequences()),
-                stretchGroup.getWidth());
+        ((ClustalxColourScheme) stretchGroup.cs).alignmentChanged(
+stretchGroup,av.getHiddenRepSequences());
       }
 
       if (stretchGroup.cs instanceof Blosum62ColourScheme