git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4503 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
asivache 2010-10-15 16:27:40 +00:00
parent c9d473edee
commit 42c3d74432
1 changed files with 6 additions and 4 deletions

View File

@ -64,8 +64,8 @@ public class OverlappingIntervalIterator implements Iterator<GenomeLoc> {
this.boundBy = new PushbackIterator<GenomeLoc>(boundBy); this.boundBy = new PushbackIterator<GenomeLoc>(boundBy);
if ( iter.hasNext() && boundBy.hasNext() ) { if ( iter.hasNext() && boundBy.hasNext() ) {
GenomeLoc currentInterval = iter.next(); // load first interval currentInterval = iter.next(); // load first interval
GenomeLoc currentBound = boundBy.next(); // load first bounding interval currentBound = boundBy.next(); // load first bounding interval
fetchNextOverlap(); fetchNextOverlap();
} }
} }
@ -76,16 +76,18 @@ public class OverlappingIntervalIterator implements Iterator<GenomeLoc> {
private void fetchNextOverlap() { private void fetchNextOverlap() {
prefetchedOverlap = null; prefetchedOverlap = null;
// System.out.println("Fetching... (interval="+currentInterval+"; bound="+currentBound+")");
while ( currentInterval != null && currentBound != null ) { while ( currentInterval != null && currentBound != null ) {
if ( currentInterval.isBefore(currentBound) ) { if ( currentInterval.isBefore(currentBound) ) {
// System.out.println(currentInterval +" is before "+currentBound );
if ( ! iter.hasNext() ) currentInterval = null; if ( ! iter.hasNext() ) currentInterval = null;
else currentInterval = iter.next(); else currentInterval = iter.next();
continue; continue;
} }
if ( currentInterval.isPast(currentBound) ) { if ( currentInterval.isPast(currentBound) ) {
// System.out.println(currentInterval +" is past "+currentBound );
if ( ! boundBy.hasNext() ) currentBound = null; if ( ! boundBy.hasNext() ) currentBound = null;
else currentBound = boundBy.next(); else currentBound = boundBy.next();
continue; continue;
@ -94,7 +96,7 @@ public class OverlappingIntervalIterator implements Iterator<GenomeLoc> {
// we are at this point only if currentInterval overlaps with currentBound // we are at this point only if currentInterval overlaps with currentBound
prefetchedOverlap = currentInterval.intersect(currentBound); prefetchedOverlap = currentInterval.intersect(currentBound);
// System.out.println("Fetched next overlap: "+prefetchedOverlap);
// now we need to advance at least one of the iterators, so that we would not // now we need to advance at least one of the iterators, so that we would not
// call the same overlap again // call the same overlap again