Lines Matching refs:fromIndex

111      * Checks that {@code fromIndex} and {@code toIndex} are in
114 private static void rangeCheck(int arrayLength, int fromIndex, int toIndex) {
115 if (fromIndex > toIndex) {
117 "fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
119 if (fromIndex < 0) {
120 throw new ArrayIndexOutOfBoundsException(fromIndex);
166 * to be sorted extends from the index {@code fromIndex}, inclusive, to
167 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
177 * @param fromIndex the index of the first element, inclusive, to be sorted
180 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
182 * if {@code fromIndex < 0} or {@code toIndex > a.length}
184 public static void sort(int[] a, int fromIndex, int toIndex) {
185 rangeCheck(a.length, fromIndex, toIndex);
186 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1, null, 0, 0);
206 * to be sorted extends from the index {@code fromIndex}, inclusive, to
207 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
217 * @param fromIndex the index of the first element, inclusive, to be sorted
220 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
222 * if {@code fromIndex < 0} or {@code toIndex > a.length}
224 public static void sort(long[] a, int fromIndex, int toIndex) {
225 rangeCheck(a.length, fromIndex, toIndex);
226 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1, null, 0, 0);
246 * to be sorted extends from the index {@code fromIndex}, inclusive, to
247 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
257 * @param fromIndex the index of the first element, inclusive, to be sorted
260 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
262 * if {@code fromIndex < 0} or {@code toIndex > a.length}
264 public static void sort(short[] a, int fromIndex, int toIndex) {
265 rangeCheck(a.length, fromIndex, toIndex);
266 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1, null, 0, 0);
286 * to be sorted extends from the index {@code fromIndex}, inclusive, to
287 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
297 * @param fromIndex the index of the first element, inclusive, to be sorted
300 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
302 * if {@code fromIndex < 0} or {@code toIndex > a.length}
304 public static void sort(char[] a, int fromIndex, int toIndex) {
305 rangeCheck(a.length, fromIndex, toIndex);
306 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1, null, 0, 0);
326 * to be sorted extends from the index {@code fromIndex}, inclusive, to
327 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
337 * @param fromIndex the index of the first element, inclusive, to be sorted
340 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
342 * if {@code fromIndex < 0} or {@code toIndex > a.length}
344 public static void sort(byte[] a, int fromIndex, int toIndex) {
345 rangeCheck(a.length, fromIndex, toIndex);
346 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
374 * to be sorted extends from the index {@code fromIndex}, inclusive, to
375 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
393 * @param fromIndex the index of the first element, inclusive, to be sorted
396 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
398 * if {@code fromIndex < 0} or {@code toIndex > a.length}
400 public static void sort(float[] a, int fromIndex, int toIndex) {
401 rangeCheck(a.length, fromIndex, toIndex);
402 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1, null, 0, 0);
430 * to be sorted extends from the index {@code fromIndex}, inclusive, to
431 * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
449 * @param fromIndex the index of the first element, inclusive, to be sorted
452 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
454 * if {@code fromIndex < 0} or {@code toIndex > a.length}
456 public static void sort(double[] a, int fromIndex, int toIndex) {
457 rangeCheck(a.length, fromIndex, toIndex);
458 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1, null, 0, 0);
493 * The range to be sorted extends from the index {@code fromIndex},
495 * {@code fromIndex == toIndex}, the range to be sorted is empty.
509 * @param fromIndex the index of the first element, inclusive, to be sorted
512 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
514 * if {@code fromIndex < 0} or {@code toIndex > a.length}
518 public static void parallelSort(byte[] a, int fromIndex, int toIndex) {
519 rangeCheck(a.length, fromIndex, toIndex);
520 int n = toIndex - fromIndex, p, g;
523 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1);
526 (null, a, new byte[n], fromIndex, n, 0,
563 * The range to be sorted extends from the index {@code fromIndex},
565 * {@code fromIndex == toIndex}, the range to be sorted is empty.
579 * @param fromIndex the index of the first element, inclusive, to be sorted
582 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
584 * if {@code fromIndex < 0} or {@code toIndex > a.length}
588 public static void parallelSort(char[] a, int fromIndex, int toIndex) {
589 rangeCheck(a.length, fromIndex, toIndex);
590 int n = toIndex - fromIndex, p, g;
593 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1, null, 0, 0);
596 (null, a, new char[n], fromIndex, n, 0,
633 * The range to be sorted extends from the index {@code fromIndex},
635 * {@code fromIndex == toIndex}, the range to be sorted is empty.
649 * @param fromIndex the index of the first element, inclusive, to be sorted
652 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
654 * if {@code fromIndex < 0} or {@code toIndex > a.length}
658 public static void parallelSort(short[] a, int fromIndex, int toIndex) {
659 rangeCheck(a.length, fromIndex, toIndex);
660 int n = toIndex - fromIndex, p, g;
663 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1, null, 0, 0);
666 (null, a, new short[n], fromIndex, n, 0,
703 * The range to be sorted extends from the index {@code fromIndex},
705 * {@code fromIndex == toIndex}, the range to be sorted is empty.
719 * @param fromIndex the index of the first element, inclusive, to be sorted
722 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
724 * if {@code fromIndex < 0} or {@code toIndex > a.length}
728 public static void parallelSort(int[] a, int fromIndex, int toIndex) {
729 rangeCheck(a.length, fromIndex, toIndex);
730 int n = toIndex - fromIndex, p, g;
733 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1, null, 0, 0);
736 (null, a, new int[n], fromIndex, n, 0,
773 * The range to be sorted extends from the index {@code fromIndex},
775 * {@code fromIndex == toIndex}, the range to be sorted is empty.
789 * @param fromIndex the index of the first element, inclusive, to be sorted
792 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
794 * if {@code fromIndex < 0} or {@code toIndex > a.length}
798 public static void parallelSort(long[] a, int fromIndex, int toIndex) {
799 rangeCheck(a.length, fromIndex, toIndex);
800 int n = toIndex - fromIndex, p, g;
803 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1, null, 0, 0);
806 (null, a, new long[n], fromIndex, n, 0,
851 * The range to be sorted extends from the index {@code fromIndex},
853 * {@code fromIndex == toIndex}, the range to be sorted is empty.
875 * @param fromIndex the index of the first element, inclusive, to be sorted
878 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
880 * if {@code fromIndex < 0} or {@code toIndex > a.length}
884 public static void parallelSort(float[] a, int fromIndex, int toIndex) {
885 rangeCheck(a.length, fromIndex, toIndex);
886 int n = toIndex - fromIndex, p, g;
889 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1, null, 0, 0);
892 (null, a, new float[n], fromIndex, n, 0,
937 * The range to be sorted extends from the index {@code fromIndex},
939 * {@code fromIndex == toIndex}, the range to be sorted is empty.
961 * @param fromIndex the index of the first element, inclusive, to be sorted
964 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
966 * if {@code fromIndex < 0} or {@code toIndex > a.length}
970 public static void parallelSort(double[] a, int fromIndex, int toIndex) {
971 rangeCheck(a.length, fromIndex, toIndex);
972 int n = toIndex - fromIndex, p, g;
975 DualPivotQuicksort.sort(a, fromIndex, toIndex - 1, null, 0, 0);
978 (null, a, new double[n], fromIndex, n, 0,
1036 * {@code fromIndex}, inclusive, to index {@code toIndex}, exclusive.
1037 * (If {@code fromIndex==toIndex}, the range to be sorted is empty.) All
1060 * @param fromIndex the index of the first element (inclusive) to be
1063 * @throws IllegalArgumentException if {@code fromIndex > toIndex} or
1066 * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or
1076 void parallelSort(T[] a, int fromIndex, int toIndex) {
1077 rangeCheck(a.length, fromIndex, toIndex);
1078 int n = toIndex - fromIndex, p, g;
1081 TimSort.sort(a, fromIndex, toIndex, NaturalOrder.INSTANCE, null, 0, 0);
1086 fromIndex, n, 0, ((g = n / (p << 2)) <= MIN_ARRAY_SORT_GRAN) ?
1142 * sorted extends from index {@code fromIndex}, inclusive, to index
1143 * {@code toIndex}, exclusive. (If {@code fromIndex==toIndex}, the
1165 * @param fromIndex the index of the first element (inclusive) to be
1171 * @throws IllegalArgumentException if {@code fromIndex > toIndex} or
1174 * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or
1183 public static <T> void parallelSort(T[] a, int fromIndex, int toIndex,
1185 rangeCheck(a.length, fromIndex, toIndex);
1188 int n = toIndex - fromIndex, p, g;
1191 TimSort.sort(a, fromIndex, toIndex, cmp, null, 0, 0);
1196 fromIndex, n, 0, ((g = n / (p << 2)) <= MIN_ARRAY_SORT_GRAN) ?
1259 * {@code fromIndex}, inclusive, to index {@code toIndex}, exclusive.
1260 * (If {@code fromIndex==toIndex}, the range to be sorted is empty.) All
1294 * @param fromIndex the index of the first element (inclusive) to be
1297 * @throws IllegalArgumentException if {@code fromIndex > toIndex} or
1300 * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or
1306 public static void sort(Object[] a, int fromIndex, int toIndex) {
1307 rangeCheck(a.length, fromIndex, toIndex);
1310 // legacyMergeSort(a, fromIndex, toIndex);
1312 ComparableTimSort.sort(a, fromIndex, toIndex, null, 0, 0);
1439 * sorted extends from index {@code fromIndex}, inclusive, to index
1440 * {@code toIndex}, exclusive. (If {@code fromIndex==toIndex}, the
1474 * @param fromIndex the index of the first element (inclusive) to be
1482 * @throws IllegalArgumentException if {@code fromIndex > toIndex} or
1485 * @throws ArrayIndexOutOfBoundsException if {@code fromIndex < 0} or
1488 public static <T> void sort(T[] a, int fromIndex, int toIndex,
1491 sort(a, fromIndex, toIndex);
1493 rangeCheck(a.length, fromIndex, toIndex);
1496 // legacyMergeSort(a, fromIndex, toIndex, c);
1498 TimSort.sort(a, fromIndex, toIndex, c, null, 0, 0);
1532 * @param fromIndex the index of the first element, inclusive
1536 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
1538 * if {@code fromIndex < 0} or {@code toIndex > array.length}
1542 public static <T> void parallelPrefix(T[] array, int fromIndex,
1545 rangeCheck(array.length, fromIndex, toIndex);
1546 if (fromIndex < toIndex)
1548 (null, op, array, fromIndex, toIndex).invoke();
1577 * @param fromIndex the index of the first element, inclusive
1581 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
1583 * if {@code fromIndex < 0} or {@code toIndex > array.length}
1587 public static void parallelPrefix(long[] array, int fromIndex,
1590 rangeCheck(array.length, fromIndex, toIndex);
1591 if (fromIndex < toIndex)
1593 (null, op, array, fromIndex, toIndex).invoke();
1625 * @param fromIndex the index of the first element, inclusive
1629 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
1631 * if {@code fromIndex < 0} or {@code toIndex > array.length}
1635 public static void parallelPrefix(double[] array, int fromIndex,
1638 rangeCheck(array.length, fromIndex, toIndex);
1639 if (fromIndex < toIndex)
1641 (null, op, array, fromIndex, toIndex).invoke();
1670 * @param fromIndex the index of the first element, inclusive
1674 * @throws IllegalArgumentException if {@code fromIndex > toIndex}
1676 * if {@code fromIndex < 0} or {@code toIndex > array.length}
1680 public static void parallelPrefix(int[] array, int fromIndex,
1683 rangeCheck(array.length, fromIndex, toIndex);
1684 if (fromIndex < toIndex)
1686 (null, op, array, fromIndex, toIndex).invoke();
1726 * @param fromIndex the index of the first element (inclusive) to be
1741 * if {@code fromIndex > toIndex}
1743 * if {@code fromIndex < 0 or toIndex > a.length}
1746 public static int binarySearch(long[] a, int fromIndex, int toIndex,
1748 rangeCheck(a.length, fromIndex, toIndex);
1749 return binarySearch0(a, fromIndex, toIndex, key);
1753 private static int binarySearch0(long[] a, int fromIndex, int toIndex,
1755 int low = fromIndex;
1807 * @param fromIndex the index of the first element (inclusive) to be
1822 * if {@code fromIndex > toIndex}
1824 * if {@code fromIndex < 0 or toIndex > a.length}
1827 public static int binarySearch(int[] a, int fromIndex, int toIndex,
1829 rangeCheck(a.length, fromIndex, toIndex);
1830 return binarySearch0(a, fromIndex, toIndex, key);
1834 private static int binarySearch0(int[] a, int fromIndex, int toIndex,
1836 int low = fromIndex;
1888 * @param fromIndex the index of the first element (inclusive) to be
1903 * if {@code fromIndex > toIndex}
1905 * if {@code fromIndex < 0 or toIndex > a.length}
1908 public static int binarySearch(short[] a, int fromIndex, int toIndex,
1910 rangeCheck(a.length, fromIndex, toIndex);
1911 return binarySearch0(a, fromIndex, toIndex, key);
1915 private static int binarySearch0(short[] a, int fromIndex, int toIndex,
1917 int low = fromIndex;
1969 * @param fromIndex the index of the first element (inclusive) to be
1984 * if {@code fromIndex > toIndex}
1986 * if {@code fromIndex < 0 or toIndex > a.length}
1989 public static int binarySearch(char[] a, int fromIndex, int toIndex,
1991 rangeCheck(a.length, fromIndex, toIndex);
1992 return binarySearch0(a, fromIndex, toIndex, key);
1996 private static int binarySearch0(char[] a, int fromIndex, int toIndex,
1998 int low = fromIndex;
2050 * @param fromIndex the index of the first element (inclusive) to be
2065 * if {@code fromIndex > toIndex}
2067 * if {@code fromIndex < 0 or toIndex > a.length}
2070 public static int binarySearch(byte[] a, int fromIndex, int toIndex,
2072 rangeCheck(a.length, fromIndex, toIndex);
2073 return binarySearch0(a, fromIndex, toIndex, key);
2077 private static int binarySearch0(byte[] a, int fromIndex, int toIndex,
2079 int low = fromIndex;
2133 * @param fromIndex the index of the first element (inclusive) to be
2148 * if {@code fromIndex > toIndex}
2150 * if {@code fromIndex < 0 or toIndex > a.length}
2153 public static int binarySearch(double[] a, int fromIndex, int toIndex,
2155 rangeCheck(a.length, fromIndex, toIndex);
2156 return binarySearch0(a, fromIndex, toIndex, key);
2160 private static int binarySearch0(double[] a, int fromIndex, int toIndex,
2162 int low = fromIndex;
2224 * @param fromIndex the index of the first element (inclusive) to be
2239 * if {@code fromIndex > toIndex}
2241 * if {@code fromIndex < 0 or toIndex > a.length}
2244 public static int binarySearch(float[] a, int fromIndex, int toIndex,
2246 rangeCheck(a.length, fromIndex, toIndex);
2247 return binarySearch0(a, fromIndex, toIndex, key);
2251 private static int binarySearch0(float[] a, int fromIndex, int toIndex,
2253 int low = fromIndex;
2328 * @param fromIndex the index of the first element (inclusive) to be
2345 * if {@code fromIndex > toIndex}
2347 * if {@code fromIndex < 0 or toIndex > a.length}
2350 public static int binarySearch(Object[] a, int fromIndex, int toIndex,
2352 rangeCheck(a.length, fromIndex, toIndex);
2353 return binarySearch0(a, fromIndex, toIndex, key);
2357 private static int binarySearch0(Object[] a, int fromIndex, int toIndex,
2359 int low = fromIndex;
2428 * @param fromIndex the index of the first element (inclusive) to be
2450 * if {@code fromIndex > toIndex}
2452 * if {@code fromIndex < 0 or toIndex > a.length}
2455 public static <T> int binarySearch(T[] a, int fromIndex, int toIndex,
2457 rangeCheck(a.length, fromIndex, toIndex);
2458 return binarySearch0(a, fromIndex, toIndex, key, c);
2462 private static <T> int binarySearch0(T[] a, int fromIndex, int toIndex,
2465 return binarySearch0(a, fromIndex, toIndex, key);
2467 int low = fromIndex;
2781 * extends from index <tt>fromIndex</tt>, inclusive, to index
2782 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
2786 * @param fromIndex the index of the first element (inclusive) to be
2791 * @throws IllegalArgumentException if <tt>fromIndex &gt; toIndex</tt>
2792 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex &lt; 0</tt> or
2795 public static void fill(long[] a, int fromIndex, int toIndex, long val) {
2796 rangeCheck(a.length, fromIndex, toIndex);
2797 for (int i = fromIndex; i < toIndex; i++)
2816 * extends from index <tt>fromIndex</tt>, inclusive, to index
2817 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
2821 * @param fromIndex the index of the first element (inclusive) to be
2826 * @throws IllegalArgumentException if <tt>fromIndex &gt; toIndex</tt>
2827 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex &lt; 0</tt> or
2830 public static void fill(int[] a, int fromIndex, int toIndex, int val) {
2831 rangeCheck(a.length, fromIndex, toIndex);
2832 for (int i = fromIndex; i < toIndex; i++)
2851 * extends from index <tt>fromIndex</tt>, inclusive, to index
2852 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
2856 * @param fromIndex the index of the first element (inclusive) to be
2861 * @throws IllegalArgumentException if <tt>fromIndex &gt; toIndex</tt>
2862 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex &lt; 0</tt> or
2865 public static void fill(short[] a, int fromIndex, int toIndex, short val) {
2866 rangeCheck(a.length, fromIndex, toIndex);
2867 for (int i = fromIndex; i < toIndex; i++)
2886 * extends from index <tt>fromIndex</tt>, inclusive, to index
2887 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
2891 * @param fromIndex the index of the first element (inclusive) to be
2896 * @throws IllegalArgumentException if <tt>fromIndex &gt; toIndex</tt>
2897 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex &lt; 0</tt> or
2900 public static void fill(char[] a, int fromIndex, int toIndex, char val) {
2901 rangeCheck(a.length, fromIndex, toIndex);
2902 for (int i = fromIndex; i < toIndex; i++)
2921 * extends from index <tt>fromIndex</tt>, inclusive, to index
2922 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
2926 * @param fromIndex the index of the first element (inclusive) to be
2931 * @throws IllegalArgumentException if <tt>fromIndex &gt; toIndex</tt>
2932 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex &lt; 0</tt> or
2935 public static void fill(byte[] a, int fromIndex, int toIndex, byte val) {
2936 rangeCheck(a.length, fromIndex, toIndex);
2937 for (int i = fromIndex; i < toIndex; i++)
2956 * extends from index <tt>fromIndex</tt>, inclusive, to index
2957 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
2961 * @param fromIndex the index of the first element (inclusive) to be
2966 * @throws IllegalArgumentException if <tt>fromIndex &gt; toIndex</tt>
2967 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex &lt; 0</tt> or
2970 public static void fill(boolean[] a, int fromIndex, int toIndex,
2972 rangeCheck(a.length, fromIndex, toIndex);
2973 for (int i = fromIndex; i < toIndex; i++)
2992 * extends from index <tt>fromIndex</tt>, inclusive, to index
2993 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
2997 * @param fromIndex the index of the first element (inclusive) to be
3002 * @throws IllegalArgumentException if <tt>fromIndex &gt; toIndex</tt>
3003 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex &lt; 0</tt> or
3006 public static void fill(double[] a, int fromIndex, int toIndex,double val){
3007 rangeCheck(a.length, fromIndex, toIndex);
3008 for (int i = fromIndex; i < toIndex; i++)
3027 * extends from index <tt>fromIndex</tt>, inclusive, to index
3028 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
3032 * @param fromIndex the index of the first element (inclusive) to be
3037 * @throws IllegalArgumentException if <tt>fromIndex &gt; toIndex</tt>
3038 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex &lt; 0</tt> or
3041 public static void fill(float[] a, int fromIndex, int toIndex, float val) {
3042 rangeCheck(a.length, fromIndex, toIndex);
3043 for (int i = fromIndex; i < toIndex; i++)
3064 * extends from index <tt>fromIndex</tt>, inclusive, to index
3065 * <tt>toIndex</tt>, exclusive. (If <tt>fromIndex==toIndex</tt>, the
3069 * @param fromIndex the index of the first element (inclusive) to be
3074 * @throws IllegalArgumentException if <tt>fromIndex &gt; toIndex</tt>
3075 * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex &lt; 0</tt> or
3080 public static void fill(Object[] a, int fromIndex, int toIndex, Object val) {
3081 rangeCheck(a.length, fromIndex, toIndex);
3082 for (int i = fromIndex; i < toIndex; i++)