< prev index next >
modules/javafx.graphics/src/main/java/com/sun/marlin/MergeSort.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -59,11 +59,10 @@
// final pass to merge both
// Merge sorted parts (auxX/auxY) into x/y arrays
if ((insertionSortIndex == 0)
|| (auxX[insertionSortIndex - 1] <= auxX[insertionSortIndex])) {
-// System.out.println("mergeSortNoCopy: ordered");
// 34 occurences
// no initial left part or both sublists (auxX, auxY) are sorted:
// copy back data into (x, y):
System.arraycopy(auxX, 0, x, 0, toIndex);
System.arraycopy(auxY, 0, y, 0, toIndex);
@@ -133,11 +132,10 @@
mergeSort(refX, refY, dstX, srcX, dstY, srcY, low, mid);
mergeSort(refX, refY, dstX, srcX, dstY, srcY, mid, high);
// If arrays are inverted ie all(A) > all(B) do swap A and B to dst
if (srcX[high - 1] <= srcX[low]) {
-// System.out.println("mergeSort: inverse ordered");
// 1561 occurences
final int left = mid - low;
final int right = high - mid;
final int off = (left != right) ? 1 : 0;
// swap parts:
@@ -149,11 +147,10 @@
}
// If arrays are already sorted, just copy from src to dest. This is an
// optimization that results in faster sorts for nearly ordered lists.
if (srcX[mid - 1] <= srcX[mid]) {
-// System.out.println("mergeSort: ordered");
// 14 occurences
System.arraycopy(srcX, low, dstX, low, length);
System.arraycopy(srcY, low, dstY, low, length);
return;
}
< prev index next >