--- /dev/null
+package jalview.api;
+
+public interface AlignmentColsCollectionI extends Iterable<Integer>
+{
+ /**
+ * Answers if the column at the given position is hidden.
+ *
+ * @param c
+ * the column index to check
+ * @return true if the column at the position is hidden
+ */
+ public boolean isHidden(int c);
+}
--- /dev/null
+package jalview.api;
+
+import jalview.datamodel.SequenceI;
+
+public interface AlignmentRowsCollectionI extends Iterable<Integer>
+{
+ /**
+ * Answers if the sequence at the given position is hidden.
+ *
+ * @param r
+ * the row index to check
+ * @return true if the sequence at r is hidden
+ */
+ public boolean isHidden(int r);
+
+ /**
+ * Answers the sequence at the given position in the alignment
+ *
+ * @param r
+ * the row index to locate
+ * @return the sequence
+ */
+ public SequenceI getSequence(int r);
+}
*/
package jalview.datamodel;
+import jalview.api.AlignmentColsCollectionI;
+
import java.util.Iterator;
-public class AlignmentColsCollection implements Iterable<Integer>
+public class AllColsCollection implements AlignmentColsCollectionI
{
int start;
int end;
ColumnSelection hidden;
- public AlignmentColsCollection(int s, int e, ColumnSelection colsel)
+ public AllColsCollection(int s, int e, ColumnSelection colsel)
{
start = s;
end = e;
{
return new AllColsIterator(start,end,hidden);
}
-
- /**
- * Answers if the column at the the current position is hidden.
- */
+
+ @Override
public boolean isHidden(int c)
{
return !hidden.isVisible(c);
private int current;
- ColumnSelection hidden;
-
public AllColsIterator(int firstcol, int lastcol,
ColumnSelection hiddenCols)
{
last = lastcol;
next = firstcol;
current = firstcol;
- hidden = hiddenCols;
}
@Override
*/
package jalview.datamodel;
+import jalview.api.AlignmentRowsCollectionI;
+
import java.util.Iterator;
-public class AlignmentRowsCollection implements Iterable<Integer>
+public class AllRowsCollection implements AlignmentRowsCollectionI
{
int start;
HiddenSequences hidden;
- public AlignmentRowsCollection(int s, int e, AlignmentI al)
+ public AllRowsCollection(int s, int e, AlignmentI al)
{
start = s;
end = e;
return new AllRowsIterator(start, end, alignment);
}
- /**
- * Answers if the sequence at the position is hidden.
- */
+ @Override
public boolean isHidden(int seq)
{
return hidden.isHidden(seq);
}
+ @Override
public SequenceI getSequence(int seq)
{
return alignment.getSequenceAtAbsoluteIndex(seq);
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+import jalview.api.AlignmentColsCollectionI;
+
+import java.util.Iterator;
+
+public class VisibleColsCollection implements AlignmentColsCollectionI
+{
+ int start;
+ int end;
+
+ ColumnSelection hidden;
+
+ public VisibleColsCollection(int s, int e, ColumnSelection colsel)
+ {
+ start = s;
+ end = e;
+ hidden = colsel;
+ }
+
+ @Override
+ public Iterator<Integer> iterator()
+ {
+ return new VisibleColsIterator(start, end, hidden);
+ }
+
+ @Override
+ public boolean isHidden(int c)
+ {
+ return false;
+ }
+
+}
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.datamodel;
+
+import jalview.api.AlignmentRowsCollectionI;
+
+import java.util.Iterator;
+
+public class VisibleRowsCollection implements AlignmentRowsCollectionI
+{
+ int start;
+
+ int end;
+
+ AlignmentI alignment;
+
+ public VisibleRowsCollection(int s, int e, AlignmentI al)
+ {
+ start = s;
+ end = e;
+ alignment = al;
+ }
+
+ @Override
+ public Iterator<Integer> iterator()
+ {
+ return new VisibleRowsIterator(start, end, alignment);
+ }
+
+ @Override
+ public boolean isHidden(int seq)
+ {
+ return false;
+ }
+
+ @Override
+ public SequenceI getSequence(int seq)
+ {
+ return alignment.getSequenceAt(seq);
+ }
+}
+
*/
package jalview.gui;
+import jalview.api.AlignmentColsCollectionI;
+import jalview.api.AlignmentRowsCollectionI;
import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.AlignmentColsCollection;
-import jalview.datamodel.AlignmentRowsCollection;
import jalview.datamodel.Annotation;
import jalview.datamodel.SequenceI;
import jalview.renderer.seqfeatures.FeatureColourFinder;
* Iterator over columns to be drawn
* @return image containing the drawing
*/
- public BufferedImage draw(AlignmentRowsCollection rows,
- AlignmentColsCollection cols)
+ public BufferedImage draw(AlignmentRowsCollectionI rows,
+ AlignmentColsCollectionI cols)
{
int rgbcolor = Color.white.getRGB();
int seqIndex = 0;
}
public void drawGraph(Graphics g, AlignmentAnnotation _aa, int charWidth,
- int y, AlignmentColsCollection cols)
+ int y, AlignmentColsCollectionI cols)
{
Annotation[] aa_annotations = _aa.annotations;
g.setColor(Color.white);
package jalview.viewmodel;
-import jalview.datamodel.AlignmentColsCollection;
+import jalview.api.AlignmentColsCollectionI;
+import jalview.api.AlignmentRowsCollectionI;
import jalview.datamodel.AlignmentI;
-import jalview.datamodel.AlignmentRowsCollection;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenSequences;
public abstract void setBoxPosition(HiddenSequences hiddenSeqs,
ColumnSelection hiddenCols, ViewportRanges ranges);
- public abstract AlignmentColsCollection getColumns(
+ public abstract AlignmentColsCollectionI getColumns(
ViewportRanges ranges, ColumnSelection hiddenCols);
- public abstract AlignmentRowsCollection getRows(
+ public abstract AlignmentRowsCollectionI getRows(
ViewportRanges ranges, AlignmentI al);
public abstract float getPixelsPerCol();
package jalview.viewmodel;
-import jalview.datamodel.AlignmentColsCollection;
+import jalview.api.AlignmentColsCollectionI;
+import jalview.api.AlignmentRowsCollectionI;
import jalview.datamodel.AlignmentI;
-import jalview.datamodel.AlignmentRowsCollection;
+import jalview.datamodel.AllColsCollection;
+import jalview.datamodel.AllRowsCollection;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenSequences;
}
@Override
- public AlignmentColsCollection getColumns(ViewportRanges ranges,
+ public AlignmentColsCollectionI getColumns(ViewportRanges ranges,
ColumnSelection hiddenCols)
{
- return new AlignmentColsCollection(0,
+ return new AllColsCollection(0,
ranges.getVisibleAlignmentWidth() - 1, hiddenCols);
}
@Override
- public AlignmentRowsCollection getRows(ViewportRanges ranges,
+ public AlignmentRowsCollectionI getRows(ViewportRanges ranges,
AlignmentI al)
{
- return new AlignmentRowsCollection(0,
+ return new AllRowsCollection(0,
ranges.getVisibleAlignmentHeight() - 1, al);
}
*/
package jalview.viewmodel;
-import jalview.datamodel.AlignmentColsCollection;
+import jalview.api.AlignmentColsCollectionI;
+import jalview.api.AlignmentRowsCollectionI;
import jalview.datamodel.AlignmentI;
-import jalview.datamodel.AlignmentRowsCollection;
+import jalview.datamodel.AllColsCollection;
+import jalview.datamodel.AllRowsCollection;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenSequences;
}
@Override
- public AlignmentColsCollection getColumns(ViewportRanges ranges,
+ public AlignmentColsCollectionI getColumns(ViewportRanges ranges,
ColumnSelection hiddenCols)
{
- return new AlignmentColsCollection(0,
+ return new AllColsCollection(0,
ranges.getAbsoluteAlignmentWidth() - 1,
hiddenCols);
}
@Override
- public AlignmentRowsCollection getRows(ViewportRanges ranges,
+ public AlignmentRowsCollectionI getRows(ViewportRanges ranges,
AlignmentI al)
{
- return new AlignmentRowsCollection(0,
+ return new AllRowsCollection(0,
ranges.getAbsoluteAlignmentHeight() - 1,
al);
}
ColumnSelection hiddenColsAtStart;
- @BeforeClass
+ @BeforeClass(groups = { "Functional" })
public void setup()
{
hiddenCols = new ColumnSelection();
Hashtable<SequenceI, SequenceCollectionI> hiddenRepSequences2 = new Hashtable<SequenceI, SequenceCollectionI>();
- @BeforeClass
+ @BeforeClass(groups = { "Functional" })
public void setup()
{
// create random alignment