public List<SequenceI> showAll(
Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
- List<SequenceI> revealedSeqs = new ArrayList<SequenceI>();
+ List<SequenceI> revealedSeqs = new ArrayList<>();
+
+ if (hiddenSequences == null)
+ {
+ return revealedSeqs;
+ }
+
for (int i = 0; i < hiddenSequences.length; i++)
{
if (hiddenSequences[i] != null)
public List<SequenceI> showSequence(int alignmentIndex,
Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
- List<SequenceI> revealedSeqs = new ArrayList<SequenceI>();
+ List<SequenceI> revealedSeqs = new ArrayList<>();
SequenceI repSequence = alignment.getSequenceAt(alignmentIndex);
if (repSequence != null && hiddenRepSequences != null
&& hiddenRepSequences.containsKey(repSequence))
* the row to start from
* @return the position of the row in the visible alignment
*/
- public int findIndexNAboveRow(int visibleDistance, int startRow)
+ public int subtractVisibleRows(int visibleDistance, int startRow)
{
// walk upwards through the alignment
// count all the non-null sequences until we have visibleDistance counted
return startRow - visibleDistance;
}
- int index = startRow;
+ int index = Math.min(startRow, hiddenSequences.length - 1);
int count = 0;
while ((index > -1) && (count < visibleDistance))
{
return false;
}
+
+ /**
+ * Answers if a sequence is hidden
+ *
+ * @param seq
+ * (absolute) index to test
+ * @return true if sequence at index seq is hidden
+ */
+ public boolean isHidden(int seq)
+ {
+ if (hiddenSequences != null)
+ {
+ return (hiddenSequences[seq] != null);
+ }
+ return false;
+ }
}