*
* - getVisibleColsIterator: iterates over the visible *columns*
*
- * For performance reasons, provide bounds where possible.
+ * For performance reasons, provide bounds where possible. Note that column
+ * numbering begins at 0 throughout this class.
*
* @author kmourao
*
* list of hidden column [start, end] ranges; the list is maintained in
* ascending start column order
*/
- private ArrayList<int[]> hiddenColumns;
+ private List<int[]> hiddenColumns;
/**
* Constructor
*/
public HiddenColumns(HiddenColumns copy)
{
- try
- {
- LOCK.writeLock().lock();
- numColumns = 0;
- if (copy != null)
- {
- if (copy.hiddenColumns != null)
- {
- hiddenColumns = new ArrayList<>();
- Iterator<int[]> it = copy.iterator();
- while (it.hasNext())
- {
- int[] region = it.next();
- hiddenColumns.add(region);
- numColumns += region[1] - region[0] + 1;
- }
- cursor.resetCursor(hiddenColumns);
- }
- }
- } finally
- {
- LOCK.writeLock().unlock();
- }
+ this(copy, Integer.MIN_VALUE, Integer.MAX_VALUE, 0);
}
/**
markHiddenRegions(hidden);
hidden.andNot(gaps);
hiddenColumns = null;
- this.hideMarkedBits(hidden);
+ this.hideColumns(hidden);
// for each sequence in the alignment, except the profile sequence,
// insert gaps corresponding to each hidden region but where each hidden
// column region is shifted backwards by the number of preceding visible
// gaps update hidden columns at the same time
Iterator<int[]> regions = hiddenColumns.iterator();
- ArrayList<int[]> newhidden = new ArrayList<>();
+ List<int[]> newhidden = new ArrayList<>();
int numGapsBefore = 0;
int gapPosition = 0;
* @param inserts
* - columns map to bits starting from zero
*/
- public void hideMarkedBits(BitSet inserts)
+ public void hideColumns(BitSet inserts)
{
try
{
*
* @param res
* visible residue position, unadjusted for hidden columns
- * @return region as [start,end] or null if no matching region is found
+ * @return region as [start,end] or null if no matching region is found. If
+ * res is adjacent to two regions, returns the left region.
*/
public int[] getRegionWithEdgeAtRes(int res)
{