Source:
<code>void accumulateSamRecord(SAMRecord rec) { for (final AlignmentBlock alignmentBlock : rec.getAlignmentBlocks()) { final int readOffset = alignmentBlock.getReadStart() - 1; final int refPos = alignmentBlock.getReferenceStart(); final int refOffset = refPos - rec.getAlignmentStart(); final int refOffsetEnd = refOffset + alignmentBlock.getLength(); <START> final int accumulatorStartAdjust = accumulator.isEmpty() ? 0 : rec.getAlignmentStart() - accumulator.get(0).getPosition(); <END> for (int j = accumulator.size() - accumulatorStartAdjust; j <= refOffsetEnd; ++j) { accumulator.add(createLocusInfo(getReferenceSequence(rec.getReferenceIndex()), rec.getAlignmentStart() + j )); } int refOffsetInterval = refOffset; int refOffsetEndInterval = refOffsetEnd; int startShift = 0; if (getIntervals() != null) { Interval interval = getCurrentInterval(); if (interval != null) { final int intervalEnd = interval.getEnd(); final int intervalStart = interval.getStart(); if (!CoordMath.overlaps(refPos, refPos + alignmentBlock.getLength(), intervalStart, intervalEnd)) { continue; } if (refPos < intervalStart) { startShift = intervalStart - refPos; refOffsetInterval = refOffsetInterval + startShift; } final int readEnd = refPos + alignmentBlock.getLength(); if (readEnd > intervalEnd) { refOffsetEndInterval = refOffsetEndInterval - (readEnd - intervalEnd) + 1; } } } final int length = refOffsetEndInterval - refOffsetInterval; final EdgingRecordAndOffset recordAndOffset = createRecordAndOffset(rec, readOffset + startShift, length, refPos + startShift); accumulator.get(refOffsetInterval).add(recordAndOffset); final EdgingRecordAndOffset recordAndOffsetEnd = createRecordAndOffset(recordAndOffset); accumulator.get(refOffsetEndInterval).add(recordAndOffsetEnd); } }</code><technical_language>Is for accumulator empty? is code (lines 145 148) accumulator.get() is called checking isEmpty()</technical_language>

Target:
void accumulateSamRecord(SAMRecord rec) { for (final AlignmentBlock alignmentBlock : rec.getAlignmentBlocks()) { final int readOffset = alignmentBlock.getReadStart() - 1; final int refPos = alignmentBlock.getReferenceStart(); if (accumulator.isEmpty()) { accumulator.add(createLocusInfo(getReferenceSequence(rec.getReferenceIndex()), rec.getAlignmentStart())); } final int accumulatorNextPosition = accumulator.get(0).getPosition() + accumulator.size(); if (accumulatorNextPosition != accumulator.get(accumulator.size() - 1).getPosition() + 1) { throw new IllegalStateException("The accumulator has gotten into a funk. Cannot continue"); } for (int locusPos = accumulatorNextPosition; locusPos <= refPos + alignmentBlock.getLength(); ++locusPos) { accumulator.add(createLocusInfo(getReferenceSequence(rec.getReferenceIndex()), locusPos)); } int refOffsetInterval = refPos - rec.getAlignmentStart(); int refOffsetEndInterval = refOffsetInterval + alignmentBlock.getLength();; int startShift = 0; if (getIntervals() != null) { Interval interval = getCurrentInterval(); if (interval != null) { final int intervalEnd = interval.getEnd(); final int intervalStart = interval.getStart(); if (!CoordMath.overlaps(refPos, refPos + alignmentBlock.getLength(), intervalStart, intervalEnd)) { continue; } if (refPos < intervalStart) { startShift = intervalStart - refPos; refOffsetInterval = refOffsetInterval + startShift; } final int readEnd = refPos + alignmentBlock.getLength(); if (readEnd > intervalEnd) { refOffsetEndInterval = refOffsetEndInterval - (readEnd - intervalEnd) + 1; } } } final int length = refOffsetEndInterval - refOffsetInterval; final EdgingRecordAndOffset recordAndOffset = createRecordAndOffset(rec, readOffset + startShift, length, refPos + startShift); accumulator.get(refOffsetInterval).add(recordAndOffset); final EdgingRecordAndOffset recordAndOffsetEnd = createRecordAndOffset(recordAndOffset); accumulator.get(refOffsetEndInterval).add(recordAndOffsetEnd); } }