In that case, just set numberOfConfiguredRanges = scan.getRanges().length.