Details
-
Type: Task
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.10.0
-
Component/s: Dev and Dep
-
Labels:None
Description
jalview.gui.AlignFrame appears to have some code that really shouldn't be there:
public static int[] getStartEnd(int[] aligmentStartEnd,
List<int[]> hiddenCols)
{
int startPos = aligmentStartEnd[0];
int endPos = aligmentStartEnd[1];
int[] lowestRange = new int[] { -1, -1 };
int[] higestRange = new int[] { -1, -1 };
for (int[] hiddenCol : hiddenCols)
{
lowestRange = (hiddenCol[0] <= startPos) ? hiddenCol : lowestRange;
higestRange = (hiddenCol[1] >= endPos) ? hiddenCol : higestRange;
}
if (lowestRange[0] == -1 && lowestRange[1] == -1)
{
startPos = aligmentStartEnd[0];
}
else
{
startPos = lowestRange[1] + 1;
}
if (higestRange[0] == -1 && higestRange[1] == -1)
{
endPos = aligmentStartEnd[1];
}
else
{
endPos = higestRange[0] - 1;
}
// System.out.println("Export range : " + startPos + " - " + endPos);
return new int[] { startPos, endPos };
}
public static void main(String[] args)
{
ArrayList<int[]> hiddenCols = new ArrayList<int[]>();
hiddenCols.add(new int[] { 0, 0 });
hiddenCols.add(new int[] { 6, 9 });
hiddenCols.add(new int[] { 11, 12 });
hiddenCols.add(new int[] { 33, 33 });
hiddenCols.add(new int[] { 50, 50 });
int[] x = getStartEnd(new int[] { 0, 50 }, hiddenCols);
// System.out.println("Export range : " + x[0] + " - " + x[1]);
}
public static int[] getStartEnd(int[] aligmentStartEnd,
List<int[]> hiddenCols)
{
int startPos = aligmentStartEnd[0];
int endPos = aligmentStartEnd[1];
int[] lowestRange = new int[] { -1, -1 };
int[] higestRange = new int[] { -1, -1 };
for (int[] hiddenCol : hiddenCols)
{
lowestRange = (hiddenCol[0] <= startPos) ? hiddenCol : lowestRange;
higestRange = (hiddenCol[1] >= endPos) ? hiddenCol : higestRange;
}
if (lowestRange[0] == -1 && lowestRange[1] == -1)
{
startPos = aligmentStartEnd[0];
}
else
{
startPos = lowestRange[1] + 1;
}
if (higestRange[0] == -1 && higestRange[1] == -1)
{
endPos = aligmentStartEnd[1];
}
else
{
endPos = higestRange[0] - 1;
}
// System.out.println("Export range : " + startPos + " - " + endPos);
return new int[] { startPos, endPos };
}
public static void main(String[] args)
{
ArrayList<int[]> hiddenCols = new ArrayList<int[]>();
hiddenCols.add(new int[] { 0, 0 });
hiddenCols.add(new int[] { 6, 9 });
hiddenCols.add(new int[] { 11, 12 });
hiddenCols.add(new int[] { 33, 33 });
hiddenCols.add(new int[] { 50, 50 });
int[] x = getStartEnd(new int[] { 0, 50 }, hiddenCols);
// System.out.println("Export range : " + x[0] + " - " + x[1]);
}
Attachments
Issue Links
- related with
-
JAL-2117 interface for jalview.datamodel.ColumnSelection
- Open