public static void removeOverlaps ( Collection < TermOccurrence > referenceSet , Collection < TermOccurrence > occurrenceSet ) { Iterator < TermOccurrence > it = occurrenceSet . iterator ( ) ; while ( it . hasNext ( ) ) { TermOccurrence occ = it . next ( ) ; for ( TermOccurrence refOcc : referenceSet ) { if ( occ . getSourceDocument ( ) . equals ( refOcc . getSourceDocument ( ) ) && areOffsetsOverlapping ( occ , refOcc ) ) { it . remove ( ) ; break ; } } } }
Removes from an occurrence set all occurrences that overlap at least one occurrence in a reference occurrence set .