X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fdatamodel%2FVisibleContigsIterator.java;h=0185978a05df45086c8c6b2eaf7f900c9c3c3a0f;hb=1e507c915398542fe6e206e7a6f2620283243f1e;hp=ff060ac2aa56ee88a1261f3592eeca895b310e4a;hpb=fa20ec4effe2fb9205d844fd85befbe785bf1a2e;p=jalview.git diff --git a/src/jalview/datamodel/VisibleContigsIterator.java b/src/jalview/datamodel/VisibleContigsIterator.java index ff060ac..0185978 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; @@ -5,7 +25,9 @@ import java.util.Iterator; import java.util.List; /** - * An iterator which iterates over visible regions in a range. + * An iterator which iterates over visible regions in a range. Provides a + * special "endsAtHidden" indicator to allow callers to determine if the final + * visible column is adjacent to a hidden region. */ public class VisibleContigsIterator implements Iterator { @@ -37,9 +59,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;