* first column (inclusive, from 0)
* @param max
* last column (exclusive)
- * @return int[][] range of {start,end} visible positions TODO: change to list
- * of int ranges
+ * @return int[][] range of {start,end} visible positions
*/
- int[][] getVisibleRegionBoundaries(int min, int max);
+ List<int[]> getVisibleRegionBoundaries(int min, int max);
/**
* This method returns an array of new SequenceI objects derived from the
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
+import java.util.List;
import java.util.Vector;
public class APopupMenu extends java.awt.PopupMenu implements
else if (source == toUpper || source == toLower || source == toggleCase)
{
SequenceGroup sg = ap.av.getSelectionGroup();
- Vector regions = new Vector();
if (sg != null)
{
- int[][] startEnd = ap.av.getVisibleRegionBoundaries(
+ List<int[]> startEnd = ap.av.getVisibleRegionBoundaries(
sg.getStartRes(), sg.getEndRes() + 1);
String description;
*/
package jalview.commands;
-import jalview.datamodel.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+
+import java.util.List;
public class ChangeCaseCommand implements CommandI
{
SequenceI[] seqs;
- int[][] regions;
+ List<int[]> regions;
public ChangeCaseCommand(String description, SequenceI[] seqs,
- int[][] regions, int caseChange)
+ List<int[]> regions, int caseChange)
{
this.description = description;
this.seqs = seqs;
String sequence;
int start, end;
char nextChar;
- for (int r = 0; r < regions.length; r++)
+ for (int[] r : regions)
{
- start = regions[r][0];
+ start = r[0];
for (int s = 0; s < seqs.length; s++)
{
sequence = seqs[s].getSequenceAsString();
StringBuffer newSeq = new StringBuffer();
- if (regions[r][1] > sequence.length())
+ if (r[1] > sequence.length())
{
end = sequence.length();
}
else
{
- end = regions[r][1];
+ end = r[1];
}
if (start > 0)
if (sg != null)
{
- int[][] startEnd = ap.av.getVisibleRegionBoundaries(sg.getStartRes(),
+ List<int[]> startEnd = ap.av.getVisibleRegionBoundaries(
+ sg.getStartRes(),
sg.getEndRes() + 1);
String description;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
-import java.util.Vector;
/**
* base class holding visualization and analysis attributes and common logic for
@Override
- public int[][] getVisibleRegionBoundaries(int min, int max)
+ public List<int[]> getVisibleRegionBoundaries(int min, int max)
{
- Vector regions = new Vector();
+ ArrayList<int[]> regions = new ArrayList<int[]>();
int start = min;
int end = max;
}
}
- regions.addElement(new int[]
+ regions.add(new int[]
{ start, end });
if (colSel != null && colSel.hasHiddenColumns())
int[][] startEnd = new int[regions.size()][2];
- regions.copyInto(startEnd);
-
- return startEnd;
-
+ return regions;
}
@Override