* process.
*/
private void popAndRecord(Stack<RangeInfo> dependencyScope, int fragment)
throws IOException {
RangeInfo rangeInfo = dependencyScope.pop();
Range toStore = rangeInfo.range;
/*
* Make a new Range for the gap between the popped Range and whatever we
* last stored.
*/
if (lastEnd < toStore.getStart()) {
Range newRange = new Range(lastEnd, toStore.getStart());
assert !dependencyScope.isEmpty();
SourceInfo gapInfo = dependencyScope.peek().info;
recordStory(gapInfo, fragment, newRange.length(), newRange);
lastEnd += newRange.length();
}
/*
* Store as much of the current Range as we haven't previously stored. The
* Max.max() is there to take care of the tail end of Ranges that have had a
* sub-range previously stored.
*/
if (lastEnd < toStore.getEnd()) {
Range newRange = new Range(Math.max(lastEnd, toStore.getStart()),
toStore.getEnd());
recordStory(rangeInfo.info, fragment, newRange.length(), newRange);
lastEnd += newRange.length();
}
}