X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FHiddenColumns.java;fp=src%2Fjalview%2Fdatamodel%2FHiddenColumns.java;h=ab71cbe68be3b6287fd66e923e2d7441be9d5bbb;hb=0e5e2bec7c3518eab6df87070b23164b135af828;hp=6e594bddb57c83469ed17311a397e4470868bd46;hpb=cfed9d8a9e10be992877d6097260758ee5563630;p=jalview.git diff --git a/src/jalview/datamodel/HiddenColumns.java b/src/jalview/datamodel/HiddenColumns.java index 6e594bd..ab71cbe 100644 --- a/src/jalview/datamodel/HiddenColumns.java +++ b/src/jalview/datamodel/HiddenColumns.java @@ -639,7 +639,7 @@ public class HiddenColumns * @return the index of the next hidden column, or alPos if there is no next * hidden column */ - public int getHiddenBoundaryRight(int alPos) + public int getNextHiddenBoundary(boolean left, int alPos) { try { @@ -647,7 +647,13 @@ public class HiddenColumns if (!hiddenColumns.isEmpty()) { int index = cursor.findRegionForColumn(alPos).getRegionIndex(); - if (index < hiddenColumns.size()) + + if (left && index > 0) + { + int[] region = hiddenColumns.get(index - 1); + return region[1]; + } + else if (!left && index < hiddenColumns.size()) { int[] region = hiddenColumns.get(index); if (alPos < region[0]) @@ -672,38 +678,6 @@ public class HiddenColumns } /** - * This method returns the leftmost limit of a region of an alignment with - * hidden columns. In otherwords, the previous hidden column. - * - * @param alPos - * the absolute (visible) alignmentPosition to find the previous - * hidden column for - */ - public int getHiddenBoundaryLeft(int alPos) - { - try - { - LOCK.readLock().lock(); - - if (!hiddenColumns.isEmpty()) - { - int index = cursor.findRegionForColumn(alPos).getRegionIndex(); - - if (index > 0) - { - int[] region = hiddenColumns.get(index - 1); - return region[1]; - } - } - return alPos; - } finally - { - LOCK.readLock().unlock(); - } - } - - - /** * Answers if a column in the alignment is visible * * @param column @@ -736,67 +710,6 @@ public class HiddenColumns } /** - * Get the visible sections of a set of sequences - * - * @param start - * sequence position to start from - * @param end - * sequence position to end at - * @param seqs - * an array of sequences - * @return an array of strings encoding the visible parts of each sequence - */ - public String[] getVisibleSequenceStrings(int start, int end, - SequenceI[] seqs) - { - try - { - LOCK.readLock().lock(); - int iSize = seqs.length; - String[] selections = new String[iSize]; - if (!hiddenColumns.isEmpty()) - { - for (int i = 0; i < iSize; i++) - { - StringBuilder visibleSeq = new StringBuilder(); - - Iterator blocks = new VisibleContigsIterator(start, - end + 1, hiddenColumns); - - while (blocks.hasNext()) - { - int[] block = blocks.next(); - if (blocks.hasNext()) - { - visibleSeq - .append(seqs[i].getSequence(block[0], block[1] + 1)); - } - else - { - visibleSeq - .append(seqs[i].getSequence(block[0], block[1])); - } - } - - selections[i] = visibleSeq.toString(); - } - } - else - { - for (int i = 0; i < iSize; i++) - { - selections[i] = seqs[i].getSequenceAsString(start, end); - } - } - - return selections; - } finally - { - LOCK.readLock().unlock(); - } - } - - /** * Locate the first position visible for this sequence. If seq isn't visible * then return the position of the left side of the hidden boundary region. *