Lines Matching refs:toIndex

358      * Checks that fromIndex ... toIndex is a valid range of bit indices.
360 private static void checkRange(int fromIndex, int toIndex) {
363 if (toIndex < 0)
364 throw new IndexOutOfBoundsException("toIndex < 0: " + toIndex);
365 if (fromIndex > toIndex)
367 " > toIndex: " + toIndex);
393 * specified {@code toIndex} (exclusive) to the complement of its current
397 * @param toIndex index after the last bit to flip
399 * or {@code toIndex} is negative, or {@code fromIndex} is
400 * larger than {@code toIndex}
403 public void flip(int fromIndex, int toIndex) {
404 checkRange(fromIndex, toIndex);
406 if (fromIndex == toIndex)
410 int endWordIndex = wordIndex(toIndex - 1);
414 long lastWordMask = WORD_MASK >>> -toIndex;
471 * specified {@code toIndex} (exclusive) to {@code true}.
474 * @param toIndex index after the last bit to be set
476 * or {@code toIndex} is negative, or {@code fromIndex} is
477 * larger than {@code toIndex}
480 public void set(int fromIndex, int toIndex) {
481 checkRange(fromIndex, toIndex);
483 if (fromIndex == toIndex)
488 int endWordIndex = wordIndex(toIndex - 1);
492 long lastWordMask = WORD_MASK >>> -toIndex;
514 * specified {@code toIndex} (exclusive) to the specified value.
517 * @param toIndex index after the last bit to be set
520 * or {@code toIndex} is negative, or {@code fromIndex} is
521 * larger than {@code toIndex}
524 public void set(int fromIndex, int toIndex, boolean value) {
526 set(fromIndex, toIndex);
528 clear(fromIndex, toIndex);
554 * specified {@code toIndex} (exclusive) to {@code false}.
557 * @param toIndex index after the last bit to be cleared
559 * or {@code toIndex} is negative, or {@code fromIndex} is
560 * larger than {@code toIndex}
563 public void clear(int fromIndex, int toIndex) {
564 checkRange(fromIndex, toIndex);
566 if (fromIndex == toIndex)
573 int endWordIndex = wordIndex(toIndex - 1);
575 toIndex = length();
580 long lastWordMask = WORD_MASK >>> -toIndex;
634 * from {@code fromIndex} (inclusive) to {@code toIndex} (exclusive).
637 * @param toIndex index after the last bit to include
640 * or {@code toIndex} is negative, or {@code fromIndex} is
641 * larger than {@code toIndex}
644 public BitSet get(int fromIndex, int toIndex) {
645 checkRange(fromIndex, toIndex);
652 if (len <= fromIndex || fromIndex == toIndex)
656 if (toIndex > len)
657 toIndex = len;
659 BitSet result = new BitSet(toIndex - fromIndex);
660 int targetWords = wordIndex(toIndex - fromIndex - 1) + 1;
671 long lastWordMask = WORD_MASK >>> -toIndex;
673 ((toIndex-1) & BIT_INDEX_MASK) < (fromIndex & BIT_INDEX_MASK)