int hideEnd;
int last = start;
- Iterator<int[]> regions = hidden.getBoundedIterator(start, end, true);
+ Iterator<int[]> regions = hidden.getBoundedIterator(start, end);
while (regions.hasNext())
{
region = regions.next();
hideStart = region[0];
hideEnd = region[1];
- // edit hidden regions to selection range
- // TODO possible bug here in original code: if hideEnd==last we continue
- // but shouldn't this be a single D at start?
- if (hideStart < last)
+ // truncate region at start if last falls in region
+ if ((hideStart < last) && (hideEnd >= last))
{
- if (hideEnd > last)
- {
- hideStart = last;
- }
- else
- {
- continue;
- }
+ hideStart = last;
}
- if (hideStart > end)
- {
- break;
- }
-
- if (hideEnd > end)
+ // truncate region at end if end falls in region
+ if (hideEnd > end) // already checked that hideStart<=end
{
hideEnd = end;
}
- if (hideStart > hideEnd)
- {
- break;
- }
/**
* form operations...
*/
}
// Final match if necessary.
- if (last < end)
+ if (last <= end)
{
addOperation(CigarArray.M, end - last + 1);
}