X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FVisibleContigsIterator.java;h=9198de8086ebc42f73416554f7b83dc6874efa24;hb=eb7a26d5a2a6168aabe6a35d434aa6546159e977;hp=d98121a11f77804c8c988fda2533e3e4cd8b2820;hpb=bdb7e11f6bad25d24bbdc0f2f509fc8ae2f485bb;p=jalview.git
diff --git a/src/jalview/datamodel/VisibleContigsIterator.java b/src/jalview/datamodel/VisibleContigsIterator.java
index d98121a..9198de8 100644
--- a/src/jalview/datamodel/VisibleContigsIterator.java
+++ b/src/jalview/datamodel/VisibleContigsIterator.java
@@ -1,3 +1,23 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.datamodel;
import java.util.ArrayList;
@@ -17,8 +37,7 @@ public class VisibleContigsIterator implements Iterator
private boolean endsAtHidden = false;
- VisibleContigsIterator(int start, int end,
- List hiddenColumns)
+ VisibleContigsIterator(int start, int end, List hiddenColumns)
{
if (hiddenColumns != null && hiddenColumns.size() > 0)
{
@@ -39,9 +58,17 @@ public class VisibleContigsIterator implements Iterator
}
if (hideStart > vstart)
{
- int[] contig = new int[] { vstart, hideStart - 1 };
- vcontigs.add(contig);
- endsAtHidden = true;
+ if (end - 1 > hideStart - 1)
+ {
+ int[] contig = new int[] { vstart, hideStart - 1 };
+ vcontigs.add(contig);
+ endsAtHidden = true;
+ }
+ else
+ {
+ int[] contig = new int[] { vstart, end - 1 };
+ vcontigs.add(contig);
+ }
}
vstart = hideEnd + 1;
@@ -85,4 +112,3 @@ public class VisibleContigsIterator implements Iterator
return endsAtHidden;
}
}
-