JAL-1807 still testing
[jalviewjs.git] / bin / jalview / util / QuickSort.js
index f8fb52f..a0960b5 100644 (file)
-Clazz.declarePackage ("jalview.util");
-Clazz.load (null, "jalview.util.QuickSort", ["java.lang.Float", "java.util.Arrays"], function () {
-c$ = Clazz.declareType (jalview.util, "QuickSort");
-c$.sortInt = Clazz.defineMethod (c$, "sortInt", 
-function (arr, s) {
-jalview.util.QuickSort.sortInt (arr, 0, arr.length - 1, s);
-}, "~A,~A");
-c$.sortFloatObject = Clazz.defineMethod (c$, "sortFloatObject", 
-function (arr, s) {
-jalview.util.QuickSort.sortFloat (arr, 0, arr.length - 1, s);
-}, "~A,~A");
-c$.sortDouble = Clazz.defineMethod (c$, "sortDouble", 
-function (arr, s) {
-jalview.util.QuickSort.sortDouble (arr, 0, arr.length - 1, s);
-}, "~A,~A");
-c$.sort = Clazz.defineMethod (c$, "sort", 
-function (arr, s) {
-jalview.util.QuickSort.stringSort (arr, 0, arr.length - 1, s);
-}, "~A,~A");
-c$.stringSort = Clazz.defineMethod (c$, "stringSort", 
-($fz = function (arr, p, r, s) {
-var q;
-if (p < r) {
-q = jalview.util.QuickSort.stringPartition (arr, p, r, s);
-jalview.util.QuickSort.stringSort (arr, p, q, s);
-jalview.util.QuickSort.stringSort (arr, q + 1, r, s);
-}}, $fz.isPrivate = true, $fz), "~A,~N,~N,~A");
-c$.sortFloat = Clazz.defineMethod (c$, "sortFloat", 
-($fz = function (arr, p, r, s) {
-var q;
-if (p < r) {
-q = jalview.util.QuickSort.partitionFloat (arr, p, r, s);
-jalview.util.QuickSort.sortFloat (arr, p, q, s);
-jalview.util.QuickSort.sortFloat (arr, q + 1, r, s);
-}}, $fz.isPrivate = true, $fz), "~A,~N,~N,~A");
-c$.sortInt = Clazz.defineMethod (c$, "sortInt", 
-($fz = function (arr, p, r, s) {
-var q;
-if (p < r) {
-q = jalview.util.QuickSort.partitionInt (arr, p, r, s);
-jalview.util.QuickSort.sortInt (arr, p, q, s);
-jalview.util.QuickSort.sortInt (arr, q + 1, r, s);
-}}, $fz.isPrivate = true, $fz), "~A,~N,~N,~A");
-c$.partitionFloat = Clazz.defineMethod (c$, "partitionFloat", 
-($fz = function (arr, p, r, s) {
-var x = arr[p];
-var i = p - 1;
-var j = r + 1;
-while (true) {
-do {
-j = j - 1;
-} while (arr[j] > x);
-do {
-i = i + 1;
-} while (arr[i] < x);
-if (i < j) {
-var tmp = arr[i];
-arr[i] = arr[j];
-arr[j] = tmp;
-var tmp2 = s[i];
-s[i] = s[j];
-s[j] = tmp2;
-} else {
-return j;
-}}
-}, $fz.isPrivate = true, $fz), "~A,~N,~N,~A");
-c$.partitionInt = Clazz.defineMethod (c$, "partitionInt", 
-($fz = function (arr, p, r, s) {
-var x = arr[p];
-var i = p - 1;
-var j = r + 1;
-while (true) {
-do {
-j = j - 1;
-} while (arr[j] > x);
-do {
-i = i + 1;
-} while (arr[i] < x);
-if (i < j) {
-var tmp = arr[i];
-arr[i] = arr[j];
-arr[j] = tmp;
-var tmp2 = s[i];
-s[i] = s[j];
-s[j] = tmp2;
-} else {
-return j;
-}}
-}, $fz.isPrivate = true, $fz), "~A,~N,~N,~A");
-c$.stringPartition = Clazz.defineMethod (c$, "stringPartition", 
-($fz = function (arr, p, r, s) {
-var x = arr[p];
-var i = p - 1;
-var j = r + 1;
-while (true) {
-do {
-j = j - 1;
-} while (arr[j].compareTo (x) < 0);
-do {
-i = i + 1;
-} while (arr[i].compareTo (x) > 0);
-if (i < j) {
-var tmp = arr[i];
-arr[i] = arr[j];
-arr[j] = tmp;
-var tmp2 = s[i];
-s[i] = s[j];
-s[j] = tmp2;
-} else {
-return j;
-}}
-}, $fz.isPrivate = true, $fz), "~A,~N,~N,~A");
-c$.sortFloatChar = Clazz.defineMethod (c$, "sortFloatChar", 
-function (arr, s) {
-var f1 =  Clazz.newFloatArray (arr.length, 0);
-var s1 =  Clazz.newCharArray (s.length, '\0');
-var nextZeroValue = 0;
-var nextNonZeroValue = arr.length - 1;
-for (var i = 0; i < arr.length; i++) {
-var val = arr[i];
-if (val > 0) {
-f1[nextNonZeroValue] = val;
-s1[nextNonZeroValue] = s[i];
-nextNonZeroValue--;
-} else {
-f1[nextZeroValue] = val;
-s1[nextZeroValue] = s[i];
-nextZeroValue++;
-}}
-System.arraycopy (f1, 0, arr, 0, nextZeroValue);
-System.arraycopy (s1, 0, s, 0, nextZeroValue);
-if (nextZeroValue == arr.length) {
-return;
-}var nonZeroFloats = java.util.Arrays.copyOfRange (f1, nextZeroValue, f1.length);
-var nonZeroChars = java.util.Arrays.copyOfRange (s1, nextZeroValue, s1.length);
-jalview.util.QuickSort.externalSortFloat (nonZeroFloats, nonZeroChars);
-System.arraycopy (nonZeroFloats, 0, arr, nextZeroValue, nonZeroFloats.length);
-System.arraycopy (nonZeroChars, 0, s, nextZeroValue, nonZeroChars.length);
-}, "~A,~A");
-c$.externalSortFloat = Clazz.defineMethod (c$, "externalSortFloat", 
-($fz = function (arr, s) {
-var length = arr.length;
-var indices = jalview.util.QuickSort.makeIndexArray (length);
-java.util.Arrays.sort (indices,  new jalview.util.QuickSort.FloatComparator (arr));
-var sortedFloats =  Clazz.newFloatArray (length, 0);
-var sortedChars =  Clazz.newCharArray (s.length, '\0');
-for (var i = 0; i < length; i++) {
-sortedFloats[i] = arr[indices[i]];
-sortedChars[i] = s[indices[i]];
-}
-System.arraycopy (sortedFloats, 0, arr, 0, length);
-System.arraycopy (sortedChars, 0, s, 0, s.length);
-}, $fz.isPrivate = true, $fz), "~A,~A");
-c$.makeIndexArray = Clazz.defineMethod (c$, "makeIndexArray", 
-($fz = function (length) {
-var indices =  new Array (length);
-for (var i = 0; i < length; i++) {
-indices[i] = new Integer (i);
-}
-return indices;
-}, $fz.isPrivate = true, $fz), "~N");
-c$.sortIntChar = Clazz.defineMethod (c$, "sortIntChar", 
-function (arr, s) {
-var f1 =  Clazz.newIntArray (arr.length, 0);
-var s1 =  Clazz.newCharArray (s.length, '\0');
-var nextZeroValue = 0;
-var nextNonZeroValue = arr.length - 1;
-for (var i = 0; i < arr.length; i++) {
-var val = arr[i];
-if (val > 0) {
-f1[nextNonZeroValue] = val;
-s1[nextNonZeroValue] = s[i];
-nextNonZeroValue--;
-} else {
-f1[nextZeroValue] = val;
-s1[nextZeroValue] = s[i];
-nextZeroValue++;
-}}
-System.arraycopy (f1, 0, arr, 0, nextZeroValue);
-System.arraycopy (s1, 0, s, 0, nextZeroValue);
-if (nextZeroValue == arr.length) {
-return;
-}var nonZeroInts = java.util.Arrays.copyOfRange (f1, nextZeroValue, f1.length);
-var nonZeroChars = java.util.Arrays.copyOfRange (s1, nextZeroValue, s1.length);
-jalview.util.QuickSort.externalSortInt (nonZeroInts, nonZeroChars);
-System.arraycopy (nonZeroInts, 0, arr, nextZeroValue, nonZeroInts.length);
-System.arraycopy (nonZeroChars, 0, s, nextZeroValue, nonZeroChars.length);
-}, "~A,~A");
-c$.externalSortInt = Clazz.defineMethod (c$, "externalSortInt", 
-($fz = function (arr, s) {
-var length = arr.length;
-var indices = jalview.util.QuickSort.makeIndexArray (length);
-java.util.Arrays.sort (indices,  new jalview.util.QuickSort.IntComparator (arr));
-var sortedInts =  Clazz.newIntArray (length, 0);
-var sortedChars =  Clazz.newCharArray (s.length, '\0');
-for (var i = 0; i < length; i++) {
-sortedInts[i] = arr[indices[i]];
-sortedChars[i] = s[indices[i]];
-}
-System.arraycopy (sortedInts, 0, arr, 0, length);
-System.arraycopy (sortedChars, 0, s, 0, s.length);
-}, $fz.isPrivate = true, $fz), "~A,~A");
-Clazz.pu$h ();
-c$ = Clazz.decorateAsClass (function () {
-this.values = null;
-Clazz.instantialize (this, arguments);
-}, jalview.util.QuickSort, "FloatComparator", null, java.util.Comparator);
-Clazz.makeConstructor (c$, 
-function (a) {
-this.values = a;
-}, "~A");
-Clazz.overrideMethod (c$, "compare", 
-function (a, b) {
-return Float.compare (this.values[a.intValue ()], this.values[b]);
-}, "Integer,Integer");
-c$ = Clazz.p0p ();
-Clazz.pu$h ();
-c$ = Clazz.decorateAsClass (function () {
-this.values = null;
-Clazz.instantialize (this, arguments);
-}, jalview.util.QuickSort, "IntComparator", null, java.util.Comparator);
-Clazz.makeConstructor (c$, 
-function (a) {
-this.values = a;
-}, "~A");
-Clazz.overrideMethod (c$, "compare", 
-function (a, b) {
-return Integer.compare (this.values[a], this.values[b]);
-}, "Integer,Integer");
-c$ = Clazz.p0p ();
-});
+Clazz.declarePackage ("jalview.util");\r
+Clazz.load (null, "jalview.util.QuickSort", ["java.lang.Float", "java.util.Arrays"], function () {\r
+c$ = Clazz.declareType (jalview.util, "QuickSort");\r
+c$.sortInt = Clazz.defineMethod (c$, "sortInt", \r
+function (arr, s) {\r
+jalview.util.QuickSort.sortInt (arr, 0, arr.length - 1, s);\r
+}, "~A,~A");\r
+c$.sortFloatObject = Clazz.defineMethod (c$, "sortFloatObject", \r
+function (arr, s) {\r
+jalview.util.QuickSort.sortFloat (arr, 0, arr.length - 1, s);\r
+}, "~A,~A");\r
+c$.sortDouble = Clazz.defineMethod (c$, "sortDouble", \r
+function (arr, s) {\r
+jalview.util.QuickSort.sortDouble (arr, 0, arr.length - 1, s);\r
+}, "~A,~A");\r
+c$.sort = Clazz.defineMethod (c$, "sort", \r
+function (arr, s) {\r
+jalview.util.QuickSort.stringSort (arr, 0, arr.length - 1, s);\r
+}, "~A,~A");\r
+c$.stringSort = Clazz.defineMethod (c$, "stringSort", \r
+($fz = function (arr, p, r, s) {\r
+var q;\r
+if (p < r) {\r
+q = jalview.util.QuickSort.stringPartition (arr, p, r, s);\r
+jalview.util.QuickSort.stringSort (arr, p, q, s);\r
+jalview.util.QuickSort.stringSort (arr, q + 1, r, s);\r
+}}, $fz.isPrivate = true, $fz), "~A,~N,~N,~A");\r
+c$.sortFloat = Clazz.defineMethod (c$, "sortFloat", \r
+($fz = function (arr, p, r, s) {\r
+var q;\r
+if (p < r) {\r
+q = jalview.util.QuickSort.partitionFloat (arr, p, r, s);\r
+jalview.util.QuickSort.sortFloat (arr, p, q, s);\r
+jalview.util.QuickSort.sortFloat (arr, q + 1, r, s);\r
+}}, $fz.isPrivate = true, $fz), "~A,~N,~N,~A");\r
+c$.sortInt = Clazz.defineMethod (c$, "sortInt", \r
+($fz = function (arr, p, r, s) {\r
+var q;\r
+if (p < r) {\r
+q = jalview.util.QuickSort.partitionInt (arr, p, r, s);\r
+jalview.util.QuickSort.sortInt (arr, p, q, s);\r
+jalview.util.QuickSort.sortInt (arr, q + 1, r, s);\r
+}}, $fz.isPrivate = true, $fz), "~A,~N,~N,~A");\r
+c$.partitionFloat = Clazz.defineMethod (c$, "partitionFloat", \r
+($fz = function (arr, p, r, s) {\r
+var x = arr[p];\r
+var i = p - 1;\r
+var j = r + 1;\r
+while (true) {\r
+do {\r
+j = j - 1;\r
+} while (arr[j] > x);\r
+do {\r
+i = i + 1;\r
+} while (arr[i] < x);\r
+if (i < j) {\r
+var tmp = arr[i];\r
+arr[i] = arr[j];\r
+arr[j] = tmp;\r
+var tmp2 = s[i];\r
+s[i] = s[j];\r
+s[j] = tmp2;\r
+} else {\r
+return j;\r
+}}\r
+}, $fz.isPrivate = true, $fz), "~A,~N,~N,~A");\r
+c$.partitionInt = Clazz.defineMethod (c$, "partitionInt", \r
+($fz = function (arr, p, r, s) {\r
+var x = arr[p];\r
+var i = p - 1;\r
+var j = r + 1;\r
+while (true) {\r
+do {\r
+j = j - 1;\r
+} while (arr[j] > x);\r
+do {\r
+i = i + 1;\r
+} while (arr[i] < x);\r
+if (i < j) {\r
+var tmp = arr[i];\r
+arr[i] = arr[j];\r
+arr[j] = tmp;\r
+var tmp2 = s[i];\r
+s[i] = s[j];\r
+s[j] = tmp2;\r
+} else {\r
+return j;\r
+}}\r
+}, $fz.isPrivate = true, $fz), "~A,~N,~N,~A");\r
+c$.stringPartition = Clazz.defineMethod (c$, "stringPartition", \r
+($fz = function (arr, p, r, s) {\r
+var x = arr[p];\r
+var i = p - 1;\r
+var j = r + 1;\r
+while (true) {\r
+do {\r
+j = j - 1;\r
+} while (arr[j].compareTo (x) < 0);\r
+do {\r
+i = i + 1;\r
+} while (arr[i].compareTo (x) > 0);\r
+if (i < j) {\r
+var tmp = arr[i];\r
+arr[i] = arr[j];\r
+arr[j] = tmp;\r
+var tmp2 = s[i];\r
+s[i] = s[j];\r
+s[j] = tmp2;\r
+} else {\r
+return j;\r
+}}\r
+}, $fz.isPrivate = true, $fz), "~A,~N,~N,~A");\r
+c$.sortFloatChar = Clazz.defineMethod (c$, "sortFloatChar", \r
+function (arr, s) {\r
+var f1 =  Clazz.newFloatArray (arr.length, 0);\r
+var s1 =  Clazz.newCharArray (s.length, '\0');\r
+var nextZeroValue = 0;\r
+var nextNonZeroValue = arr.length - 1;\r
+for (var i = 0; i < arr.length; i++) {\r
+var val = arr[i];\r
+if (val > 0) {\r
+f1[nextNonZeroValue] = val;\r
+s1[nextNonZeroValue] = s[i];\r
+nextNonZeroValue--;\r
+} else {\r
+f1[nextZeroValue] = val;\r
+s1[nextZeroValue] = s[i];\r
+nextZeroValue++;\r
+}}\r
+System.arraycopy (f1, 0, arr, 0, nextZeroValue);\r
+System.arraycopy (s1, 0, s, 0, nextZeroValue);\r
+if (nextZeroValue == arr.length) {\r
+return;\r
+}var nonZeroFloats = java.util.Arrays.copyOfRange (f1, nextZeroValue, f1.length);\r
+var nonZeroChars = java.util.Arrays.copyOfRange (s1, nextZeroValue, s1.length);\r
+jalview.util.QuickSort.externalSortFloat (nonZeroFloats, nonZeroChars);\r
+System.arraycopy (nonZeroFloats, 0, arr, nextZeroValue, nonZeroFloats.length);\r
+System.arraycopy (nonZeroChars, 0, s, nextZeroValue, nonZeroChars.length);\r
+}, "~A,~A");\r
+c$.externalSortFloat = Clazz.defineMethod (c$, "externalSortFloat", \r
+($fz = function (arr, s) {\r
+var length = arr.length;\r
+var indices = jalview.util.QuickSort.makeIndexArray (length);\r
+java.util.Arrays.sort (indices,  new jalview.util.QuickSort.FloatComparator (arr));\r
+var sortedFloats =  Clazz.newFloatArray (length, 0);\r
+var sortedChars =  Clazz.newCharArray (s.length, '\0');\r
+for (var i = 0; i < length; i++) {\r
+sortedFloats[i] = arr[indices[i]];\r
+sortedChars[i] = s[indices[i]];\r
+}\r
+System.arraycopy (sortedFloats, 0, arr, 0, length);\r
+System.arraycopy (sortedChars, 0, s, 0, s.length);\r
+}, $fz.isPrivate = true, $fz), "~A,~A");\r
+c$.makeIndexArray = Clazz.defineMethod (c$, "makeIndexArray", \r
+($fz = function (length) {\r
+var indices =  new Array (length);\r
+for (var i = 0; i < length; i++) {\r
+indices[i] = new Integer (i);\r
+}\r
+return indices;\r
+}, $fz.isPrivate = true, $fz), "~N");\r
+c$.sortIntChar = Clazz.defineMethod (c$, "sortIntChar", \r
+function (arr, s) {\r
+var f1 =  Clazz.newIntArray (arr.length, 0);\r
+var s1 =  Clazz.newCharArray (s.length, '\0');\r
+var nextZeroValue = 0;\r
+var nextNonZeroValue = arr.length - 1;\r
+for (var i = 0; i < arr.length; i++) {\r
+var val = arr[i];\r
+if (val > 0) {\r
+f1[nextNonZeroValue] = val;\r
+s1[nextNonZeroValue] = s[i];\r
+nextNonZeroValue--;\r
+} else {\r
+f1[nextZeroValue] = val;\r
+s1[nextZeroValue] = s[i];\r
+nextZeroValue++;\r
+}}\r
+System.arraycopy (f1, 0, arr, 0, nextZeroValue);\r
+System.arraycopy (s1, 0, s, 0, nextZeroValue);\r
+if (nextZeroValue == arr.length) {\r
+return;\r
+}var nonZeroInts = java.util.Arrays.copyOfRange (f1, nextZeroValue, f1.length);\r
+var nonZeroChars = java.util.Arrays.copyOfRange (s1, nextZeroValue, s1.length);\r
+jalview.util.QuickSort.externalSortInt (nonZeroInts, nonZeroChars);\r
+System.arraycopy (nonZeroInts, 0, arr, nextZeroValue, nonZeroInts.length);\r
+System.arraycopy (nonZeroChars, 0, s, nextZeroValue, nonZeroChars.length);\r
+}, "~A,~A");\r
+c$.externalSortInt = Clazz.defineMethod (c$, "externalSortInt", \r
+($fz = function (arr, s) {\r
+var length = arr.length;\r
+var indices = jalview.util.QuickSort.makeIndexArray (length);\r
+java.util.Arrays.sort (indices,  new jalview.util.QuickSort.IntComparator (arr));\r
+var sortedInts =  Clazz.newIntArray (length, 0);\r
+var sortedChars =  Clazz.newCharArray (s.length, '\0');\r
+for (var i = 0; i < length; i++) {\r
+sortedInts[i] = arr[indices[i]];\r
+sortedChars[i] = s[indices[i]];\r
+}\r
+System.arraycopy (sortedInts, 0, arr, 0, length);\r
+System.arraycopy (sortedChars, 0, s, 0, s.length);\r
+}, $fz.isPrivate = true, $fz), "~A,~A");\r
+Clazz.pu$h ();\r
+c$ = Clazz.decorateAsClass (function () {\r
+this.values = null;\r
+Clazz.instantialize (this, arguments);\r
+}, jalview.util.QuickSort, "FloatComparator", null, java.util.Comparator);\r
+Clazz.makeConstructor (c$, \r
+function (a) {\r
+this.values = a;\r
+}, "~A");\r
+Clazz.overrideMethod (c$, "compare", \r
+function (a, b) {\r
+return Float.compare (this.values[a.intValue ()], this.values[b]);\r
+}, "Integer,Integer");\r
+c$ = Clazz.p0p ();\r
+Clazz.pu$h ();\r
+c$ = Clazz.decorateAsClass (function () {\r
+this.values = null;\r
+Clazz.instantialize (this, arguments);\r
+}, jalview.util.QuickSort, "IntComparator", null, java.util.Comparator);\r
+Clazz.makeConstructor (c$, \r
+function (a) {\r
+this.values = a;\r
+}, "~A");\r
+Clazz.overrideMethod (c$, "compare", \r
+function (a, b) {\r
+return Integer.compare (this.values[a], this.values[b]);\r
+}, "Integer,Integer");\r
+c$ = Clazz.p0p ();\r
+});\r