/** * Get the desired Range, reletive to this Dataset, if no overlap, return null. * <p> wantStart, wantStop are the indices in the aggregated dataset, wantStart <= i < wantEnd. * if this overlaps, set the Range required for the nested dataset. * note this should handle strides ok. * * @param totalRange desired range, reletive to aggregated dimension. * @return desired Range or null if theres nothing wanted from this datase. * @throws InvalidRangeException if invalid range request */ protected Range getNestedJoinRange(Range totalRange) throws InvalidRangeException { int wantStart = totalRange.first(); int wantStop = totalRange.last() + 1; // Range has last inclusive, we use last exclusive // see if this dataset is needed if (!isNeeded(wantStart, wantStop)) return null; int firstInInterval = totalRange.getFirstInInterval(aggStart); if ((firstInInterval < 0) || (firstInInterval >= aggEnd)) return null; int start = Math.max(firstInInterval, wantStart) - aggStart; int stop = Math.min(aggEnd, wantStop) - aggStart; return new Range(start, stop - 1, totalRange.stride()); // Range has last inclusive }
/** * Get the desired Range, reletive to this Dataset, if no overlap, return null. * <p> wantStart, wantStop are the indices in the aggregated dataset, wantStart <= i < wantEnd. * if this overlaps, set the Range required for the nested dataset. * note this should handle strides ok. * * @param totalRange desired range, reletive to aggregated dimension. * @return desired Range or null if theres nothing wanted from this datase. * @throws InvalidRangeException if invalid range request */ protected Range getNestedJoinRange(Range totalRange) throws InvalidRangeException { int wantStart = totalRange.first(); int wantStop = totalRange.last() + 1; // Range has last inclusive, we use last exclusive // see if this dataset is needed if (!isNeeded(wantStart, wantStop)) return null; int firstInInterval = totalRange.getFirstInInterval(aggStart); if ((firstInInterval < 0) || (firstInInterval >= aggEnd)) return null; int start = Math.max(firstInInterval, wantStart) - aggStart; int stop = Math.min(aggEnd, wantStop) - aggStart; return new Range(start, stop - 1, totalRange.stride()); // Range has last inclusive }
/** * Get the desired Range, reletive to this Dataset, if no overlap, return null. * <p> wantStart, wantStop are the indices in the aggregated dataset, wantStart <= i < wantEnd. * if this overlaps, set the Range required for the nested dataset. * note this should handle strides ok. * * @param totalRange desired range, reletive to aggregated dimension. * @return desired Range or null if theres nothing wanted from this datase. * @throws InvalidRangeException if invalid range request */ protected Range getNestedJoinRange(Range totalRange) throws InvalidRangeException { int wantStart = totalRange.first(); int wantStop = totalRange.last() + 1; // Range has last inclusive, we use last exclusive // see if this dataset is needed if (!isNeeded(wantStart, wantStop)) return null; int firstInInterval = totalRange.getFirstInInterval(aggStart); if ((firstInInterval < 0) || (firstInInterval >= aggEnd)) return null; int start = Math.max(firstInInterval, wantStart) - aggStart; int stop = Math.min(aggEnd, wantStop) - aggStart; return new Range(start, stop - 1, totalRange.stride()); // Range has last inclusive }