/** * Returns true if any of the file spans in this FilePointer overlap their counterparts in * the other FilePointer. "Overlap" is defined as having an overlapping extent (the region * from the start of the first chunk to the end of the last chunk). * * @param other the FilePointer against which to check overlap with this FilePointer * @return true if any file spans overlap their counterparts in other, otherwise false */ public boolean hasFileSpansOverlappingWith( FilePointer other ) { for ( Map.Entry<SAMReaderID, SAMFileSpan> thisFilePointerEntry : fileSpans.entrySet() ) { GATKBAMFileSpan thisFileSpan = new GATKBAMFileSpan(thisFilePointerEntry.getValue()); SAMFileSpan otherEntry = other.fileSpans.get(thisFilePointerEntry.getKey()); if ( otherEntry == null ) { continue; // no counterpart for this file span in other } GATKBAMFileSpan otherFileSpan = new GATKBAMFileSpan(otherEntry); if ( thisFileSpan.getExtent().overlaps(otherFileSpan.getExtent()) ) { return true; } } return false; }