From: gmungoc Date: Wed, 8 Jul 2015 14:00:25 +0000 (+0100) Subject: JAL-1807 disambiguated method signatures with numeric primitive args X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e1e98ff6e24e5f26f07ab94cdd94799891662319;p=jalview.git JAL-1807 disambiguated method signatures with numeric primitive args --- diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index 50045dc..6dd3a97 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -327,7 +327,7 @@ public class AAFrequency .append(((c == 0) ? "" : "; ")) .append(alphabet[c]) .append(" ") - .append(((fmt != null) ? fmt.form(tval) : ((int) tval))) + .append(((fmt != null) ? fmt.formDouble(tval) : ((int) tval))) .append("%"); } } @@ -344,7 +344,7 @@ public class AAFrequency // { (char) c }; vl[c] = profile[0][c]; } - QuickSort.sort(vl, ca); + QuickSort.sortFloat(vl, ca); for (int p = 0, c = ca.length - 1; profile[0][ca[c]] > 0; c--) { final char residue = ca[c]; @@ -355,7 +355,7 @@ public class AAFrequency .append((((p == 0) ? "" : "; "))) .append(residue) .append(" ") - .append(((fmt != null) ? fmt.form(tval) + .append(((fmt != null) ? fmt.formDouble(tval) : ((int) tval))).append("%"); p++; } @@ -365,7 +365,7 @@ public class AAFrequency else { mouseOver.append( - (((fmt != null) ? fmt.form(value) : ((int) value)))) + (((fmt != null) ? fmt.formDouble(value) : ((int) value)))) .append("%"); } consensus.annotations[i] = new Annotation(maxRes, @@ -425,7 +425,7 @@ public class AAFrequency ca[c] = (char) c; vl[c] = profile[0][c]; } - QuickSort.sort(vl, ca); + QuickSort.sortFloat(vl, ca); int nextArrayPos = 2; int totalPercentage = 0; int distinctValuesCount = 0; @@ -480,7 +480,7 @@ public class AAFrequency { codons[i] = (char) i; } - QuickSort.sort(sortedCounts, codons); + QuickSort.sortInt(sortedCounts, codons); int totalPercentage = 0; int distinctValuesCount = 0; int j = 3; @@ -615,7 +615,7 @@ public class AAFrequency int[] sortedCodonCounts = new int[codonCounts.length - 2]; System.arraycopy(codonCounts, 2, sortedCodonCounts, 0, codonCounts.length - 2); - QuickSort.sort(sortedCodonCounts, codons); + QuickSort.sortInt(sortedCodonCounts, codons); int modalCodonEncoded = codons[codons.length - 1]; int modalCodonCount = sortedCodonCounts[codons.length - 1]; @@ -665,7 +665,7 @@ public class AAFrequency String codon = String .valueOf(CodingUtils.decodeCodon(codonEncoded)); percent = fmt == null ? Integer.toString(pct) : fmt - .form(pct); + .formLong(pct); if (showProfileLogo || codonCount == modalCodonCount) { if (percent.equals(lastPercent) && j > 0) diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index 5612133..f76e801 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -664,7 +664,7 @@ public class AlignSeq pid = pid / (aseq1.length - count) * 100; output = output.append(new Format("Percentage ID = %2.2f\n\n") - .form(pid)); + .formDouble(pid)); try { @@ -707,7 +707,7 @@ public class AlignSeq Format.print(System.out, "%3s", s1str.substring(i, i + 1)); } - Format.print(System.out, "%3d ", mat[i][j] / 10); + Format.printLong(System.out, "%3d ", mat[i][j] / 10); } System.out.println(); diff --git a/src/jalview/analysis/AlignmentSorter.java b/src/jalview/analysis/AlignmentSorter.java index 2fad332..4f7f2e2 100755 --- a/src/jalview/analysis/AlignmentSorter.java +++ b/src/jalview/analysis/AlignmentSorter.java @@ -129,7 +129,7 @@ public class AlignmentSorter seqs[i] = align.getSequenceAt(i); } - QuickSort.sort(scores, seqs); + QuickSort.sortFloat(scores, seqs); setReverseOrder(align, seqs); } @@ -268,7 +268,7 @@ public class AlignmentSorter length[i] = (seqs[i].getEnd() - seqs[i].getStart()); } - QuickSort.sort(length, seqs); + QuickSort.sortFloat(length, seqs); if (sortLengthAscending) { @@ -607,7 +607,7 @@ public class AlignmentSorter .floatValue(); } - jalview.util.QuickSort.sort(ids, alignment); + jalview.util.QuickSort.sortFloat(ids, alignment); } /** @@ -674,7 +674,7 @@ public class AlignmentSorter } } - jalview.util.QuickSort.sort(scores, seqs); + jalview.util.QuickSort.sortDouble(scores, seqs); if (lastSortByScore != scoreLabel) { lastSortByScore = scoreLabel; @@ -905,7 +905,7 @@ public class AlignmentSorter } } - jalview.util.QuickSort.sort(scores, seqs); + jalview.util.QuickSort.sortDouble(scores, seqs); } else if (method == FEATURE_DENSITY) { @@ -922,7 +922,7 @@ public class AlignmentSorter // System.err.println("Sorting on Density: seq "+seqs[i].getName()+ // " Feats: "+nf+" Score : "+scores[i]); } - jalview.util.QuickSort.sort(scores, seqs); + jalview.util.QuickSort.sortDouble(scores, seqs); } else { diff --git a/src/jalview/analysis/StructureFrequency.java b/src/jalview/analysis/StructureFrequency.java index 3c8274e..7502724 100644 --- a/src/jalview/analysis/StructureFrequency.java +++ b/src/jalview/analysis/StructureFrequency.java @@ -433,7 +433,7 @@ public class StructureFrequency x++; } } - jalview.util.QuickSort.sort(vl, ca); + jalview.util.QuickSort.sortFloat(vl, ca); int p = 0; /* @@ -447,7 +447,7 @@ public class StructureFrequency { tval = (vl[c] * 100f / divisor); mouseOver += ((p == 0) ? "" : "; ") + (char) ca[c][0] - + (char) ca[c][1] + " " + fmt.form(tval) + + (char) ca[c][1] + " " + fmt.formDouble(tval) + "%"; p++; @@ -458,7 +458,7 @@ public class StructureFrequency } else { - mouseOver += (fmt.form(value) + "%"); + mouseOver += (fmt.formDouble(value) + "%"); } consensus.annotations[i] = new Annotation(maxRes, mouseOver, ' ', value); @@ -499,7 +499,7 @@ public class StructureFrequency x++; } } - jalview.util.QuickSort.sort(vl, ca); + jalview.util.QuickSort.sortFloat(vl, ca); int valuesCount = 0; rtnval[1] = 0; diff --git a/src/jalview/appletgui/PairwiseAlignPanel.java b/src/jalview/appletgui/PairwiseAlignPanel.java index 7574802..27470f0 100644 --- a/src/jalview/appletgui/PairwiseAlignPanel.java +++ b/src/jalview/appletgui/PairwiseAlignPanel.java @@ -117,7 +117,7 @@ public class PairwiseAlignPanel extends Panel implements ActionListener { for (int j = 0; j < i; j++) { - jalview.util.Format.print(System.out, "%7.3f", scores[i][j] + jalview.util.Format.printDouble(System.out, "%7.3f", scores[i][j] / totscore); } } diff --git a/src/jalview/appletgui/RotatableCanvas.java b/src/jalview/appletgui/RotatableCanvas.java index 377186a..6668849 100755 --- a/src/jalview/appletgui/RotatableCanvas.java +++ b/src/jalview/appletgui/RotatableCanvas.java @@ -470,10 +470,10 @@ public class RotatableCanvas extends Panel implements MouseListener, for (int i = 0; i < npoint; i++) { SequencePoint sp = (SequencePoint) points.elementAt(i); - Format.print(System.out, "%5d ", i); + Format.printLong(System.out, "%5d ", i); for (int j = 0; j < 3; j++) { - Format.print(System.out, "%13.3f ", sp.coord[j]); + Format.printDouble(System.out, "%13.3f ", sp.coord[j]); } System.out.println(); } diff --git a/src/jalview/appletgui/TreeCanvas.java b/src/jalview/appletgui/TreeCanvas.java index edcd961..64dd412 100755 --- a/src/jalview/appletgui/TreeCanvas.java +++ b/src/jalview/appletgui/TreeCanvas.java @@ -191,7 +191,7 @@ public class TreeCanvas extends Panel implements MouseListener, String nodeLabel = ""; if (showDistances && node.dist > 0) { - nodeLabel = new Format("%-.2f").form(node.dist); + nodeLabel = new Format("%-.2f").formDouble(node.dist); } if (showBootstrap) { @@ -276,7 +276,7 @@ public class TreeCanvas extends Panel implements MouseListener, if (showDistances && (node.dist > 0)) { - nodeLabel = new Format("%-.2f").form(node.dist); + nodeLabel = new Format("%-.2f").formDouble(node.dist); } if (showBootstrap) diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 940a216..2818fb9 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -698,7 +698,7 @@ public class FeatureSettings extends JPanel implements } if (sort) { - jalview.util.QuickSort.sort(order, data); + jalview.util.QuickSort.sortFloat(order, data); } } @@ -833,7 +833,7 @@ public class FeatureSettings extends JPanel implements sortOrder[i] = fr.getOrder(sortTypes[i]); i++; } - jalview.util.QuickSort.sort(sortOrder, sortTypes); + jalview.util.QuickSort.sortFloat(sortOrder, sortTypes); sortOrder = null; Object fcol; GraduatedColor gcol; @@ -943,7 +943,7 @@ public class FeatureSettings extends JPanel implements } if (sort) { - jalview.util.QuickSort.sort(width, data); + jalview.util.QuickSort.sortFloat(width, data); // update global priority order } diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index e4ec30b..b8fc077 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -4654,7 +4654,7 @@ public class Jalview2XML srt[s++] = jvar.order; } reorder.clear(); - jalview.util.QuickSort.sort(srt, rws); + jalview.util.QuickSort.sortInt(srt, rws); // and re-insert the annotation at its correct position for (JvAnnotRow jvar : rws) { diff --git a/src/jalview/gui/PairwiseAlignPanel.java b/src/jalview/gui/PairwiseAlignPanel.java index 22f1368..2c65a49 100755 --- a/src/jalview/gui/PairwiseAlignPanel.java +++ b/src/jalview/gui/PairwiseAlignPanel.java @@ -122,7 +122,7 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel { for (int j = 0; j < i; j++) { - jalview.util.Format.print(System.out, "%7.3f", scores[i][j] + jalview.util.Format.printDouble(System.out, "%7.3f", scores[i][j] / totscore); } } diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index 1bce84b..702a24e 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -261,7 +261,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, if (showDistances && (node.dist > 0)) { - nodeLabel = new Format("%-.2f").form(node.dist); + nodeLabel = new Format("%-.2f").formDouble(node.dist); } if (showBootstrap && node.bootstrap > -1) @@ -348,7 +348,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, if (showDistances && (node.dist > 0)) { - nodeLabel = new Format("%-.2f").form(node.dist); + nodeLabel = new Format("%-.2f").formDouble(node.dist); } if (showBootstrap && node.bootstrap > -1) diff --git a/src/jalview/io/MSFfile.java b/src/jalview/io/MSFfile.java index 3de5b30..cfa733c 100755 --- a/src/jalview/io/MSFfile.java +++ b/src/jalview/io/MSFfile.java @@ -302,8 +302,8 @@ public class MSFfile extends AlignFile nameBlock[i] = new String(" Name: " + printId(s[i]) + " "); idBlock[i] = new String("Len: " - + maxLenpad.form(s[i].getSequence().length) + " Check: " - + maxChkpad.form(checksums[i]) + " Weight: 1.00" + newline); + + maxLenpad.formLong(s[i].getSequence().length) + " Check: " + + maxChkpad.formLong(checksums[i]) + " Weight: 1.00" + newline); if (s[i].getName().length() > maxid) { diff --git a/src/jalview/math/Matrix.java b/src/jalview/math/Matrix.java index 9ac75d2..fb8d295 100755 --- a/src/jalview/math/Matrix.java +++ b/src/jalview/math/Matrix.java @@ -104,7 +104,7 @@ public class Matrix { for (int j = 0; j < cols; j++) { - Format.print(ps, "%8.2f", value[i][j]); + Format.printDouble(ps, "%8.2f", value[i][j]); } ps.println(); @@ -762,7 +762,7 @@ public class Matrix { for (int j = 0; j < rows; j++) { - Format.print(ps, "%15.4e", d[j]); + Format.printDouble(ps, "%15.4e", d[j]); } } @@ -776,7 +776,7 @@ public class Matrix { for (int j = 0; j < rows; j++) { - Format.print(ps, "%15.4e", e[j]); + Format.printDouble(ps, "%15.4e", e[j]); } } diff --git a/src/jalview/util/Format.java b/src/jalview/util/Format.java index d14e4ad..1c8e444 100755 --- a/src/jalview/util/Format.java +++ b/src/jalview/util/Format.java @@ -309,9 +309,9 @@ public class Format * @param x * the double to print */ - public static void print(java.io.PrintStream s, String fmt, double x) + public static void printDouble(java.io.PrintStream s, String fmt, double x) { - s.print(new Format(fmt).form(x)); + s.print(new Format(fmt).formDouble(x)); } /** @@ -324,9 +324,9 @@ public class Format * @param x * the long to print */ - public static void print(java.io.PrintStream s, String fmt, long x) + public static void printLong(java.io.PrintStream s, String fmt, long x) { - s.print(new Format(fmt).form(x)); + s.print(new Format(fmt).formLong(x)); } /** @@ -339,9 +339,9 @@ public class Format * @param x * the character to */ - public static void print(java.io.PrintStream s, String fmt, char x) + public static void printChar(java.io.PrintStream s, String fmt, char x) { - s.print(new Format(fmt).form(x)); + s.print(new Format(fmt).formChar(x)); } /** @@ -544,7 +544,7 @@ public class Format * @exception IllegalArgumentException * if bad argument */ - public String form(double x) + public String formDouble(double x) { String r; @@ -584,7 +584,7 @@ public class Format * the number to format * @return the formatted string */ - public String form(long x) + public String formLong(long x) { String r; int s = 0; @@ -629,7 +629,7 @@ public class Format * the value to format * @return the formatted string */ - public String form(char c) + public String formChar(char c) { if (fmt != 'c') { diff --git a/src/jalview/util/GroupUrlLink.java b/src/jalview/util/GroupUrlLink.java index 4900fc8..6665f51 100644 --- a/src/jalview/util/GroupUrlLink.java +++ b/src/jalview/util/GroupUrlLink.java @@ -150,7 +150,7 @@ public class GroupUrlLink } ptok[ntoks] = link.length(); tmtch[ntoks] = "$$$$$$$$$"; - jalview.util.QuickSort.sort(ptok, tmtch); + jalview.util.QuickSort.sortInt(ptok, tmtch); for (int i = 0; i < ntoks; i++) { mtch[i] = tmtch[i]; // TODO: check order is ascending diff --git a/src/jalview/util/QuickSort.java b/src/jalview/util/QuickSort.java index 4826bc3..b0e75be 100755 --- a/src/jalview/util/QuickSort.java +++ b/src/jalview/util/QuickSort.java @@ -75,9 +75,9 @@ public class QuickSort * @param arr * @param s */ - public static void sort(int[] arr, Object[] s) + public static void sortInt(int[] arr, Object[] s) { - sort(arr, 0, arr.length - 1, s); + sortInt(arr, 0, arr.length - 1, s); } /** @@ -87,9 +87,9 @@ public class QuickSort * @param arr * @param s */ - public static void sort(float[] arr, Object[] s) + public static void sortFloat(float[] arr, Object[] s) { - sort(arr, 0, arr.length - 1, s); + sortFloat(arr, 0, arr.length - 1, s); } /** @@ -99,9 +99,9 @@ public class QuickSort * @param arr * @param s */ - public static void sort(double[] arr, Object[] s) + public static void sortDouble(double[] arr, Object[] s) { - sort(arr, 0, arr.length - 1, s); + sortDouble(arr, 0, arr.length - 1, s); } /** @@ -128,43 +128,43 @@ public class QuickSort } } - static void sort(float[] arr, int p, int r, Object[] s) + static void sortFloat(float[] arr, int p, int r, Object[] s) { int q; if (p < r) { - q = partition(arr, p, r, s); - sort(arr, p, q, s); - sort(arr, q + 1, r, s); + q = partitionFloat(arr, p, r, s); + sortFloat(arr, p, q, s); + sortFloat(arr, q + 1, r, s); } } - static void sort(double[] arr, int p, int r, Object[] s) + static void sortDouble(double[] arr, int p, int r, Object[] s) { int q; if (p < r) { - q = partition(arr, p, r, s); - sort(arr, p, q, s); - sort(arr, q + 1, r, s); + q = partitionDouble(arr, p, r, s); + sortDouble(arr, p, q, s); + sortDouble(arr, q + 1, r, s); } } - static void sort(int[] arr, int p, int r, Object[] s) + static void sortInt(int[] arr, int p, int r, Object[] s) { int q; if (p < r) { - q = partition(arr, p, r, s); - sort(arr, p, q, s); - sort(arr, q + 1, r, s); + q = partitionInt(arr, p, r, s); + sortInt(arr, p, q, s); + sortInt(arr, q + 1, r, s); } } - static int partition(float[] arr, int p, int r, Object[] s) + static int partitionFloat(float[] arr, int p, int r, Object[] s) { float x = arr[p]; int i = p - 1; @@ -199,7 +199,7 @@ public class QuickSort } } - static int partition(float[] arr, int p, int r, char[] s) + static int partitionFloat(float[] arr, int p, int r, char[] s) { float x = arr[p]; int i = p - 1; @@ -234,7 +234,7 @@ public class QuickSort } } - static int partition(int[] arr, int p, int r, Object[] s) + static int partitionInt(int[] arr, int p, int r, Object[] s) { int x = arr[p]; int i = p - 1; @@ -269,7 +269,7 @@ public class QuickSort } } - static int partition(double[] arr, int p, int r, Object[] s) + static int partitionDouble(double[] arr, int p, int r, Object[] s) { double x = arr[p]; int i = p - 1; @@ -346,7 +346,7 @@ public class QuickSort * @param arr * @param s */ - public static void sort(float[] arr, char[] s) + public static void sortFloat(float[] arr, char[] s) { /* * Sort all zero values to the front @@ -449,14 +449,14 @@ public class QuickSort return indices; } - static void sort(float[] arr, int p, int r, char[] s) + static void sortFloat(float[] arr, int p, int r, char[] s) { int q; if (p < r) { - q = partition(arr, p, r, s); - sort(arr, p, q, s); - sort(arr, q + 1, r, s); + q = partitionFloat(arr, p, r, s); + sortFloat(arr, p, q, s); + sortFloat(arr, q + 1, r, s); } } @@ -467,7 +467,7 @@ public class QuickSort * @param arr * @param s */ - public static void sort(int[] arr, char[] s) + public static void sortInt(int[] arr, char[] s) { /* * Sort all zero values to the front diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java index 674f3d1..e7cec1e 100644 --- a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java +++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java @@ -506,7 +506,7 @@ public abstract class FeatureRendererModel implements } if (iSize > 1 && sort) { - jalview.util.QuickSort.sort(sortOrder, newf); + jalview.util.QuickSort.sortFloat(sortOrder, newf); } sortOrder = null; System.arraycopy(newf, 0, renderOrder, opos, newf.length); diff --git a/src/jalview/ws/jws2/Jws2Discoverer.java b/src/jalview/ws/jws2/Jws2Discoverer.java index 16d83e8..938a760 100644 --- a/src/jalview/ws/jws2/Jws2Discoverer.java +++ b/src/jalview/ws/jws2/Jws2Discoverer.java @@ -277,7 +277,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI spos[ipos++] = 1000 * svcUrls.indexOf(svc.getHost()) + 1 + svctypes.indexOf(svc.serviceType); } - jalview.util.QuickSort.sort(spos, svcs); + jalview.util.QuickSort.sortInt(spos, svcs); services = new Vector(); for (Jws2Instance svc : svcs) { diff --git a/src/jalview/ws/rest/params/SeqGroupIndexVector.java b/src/jalview/ws/rest/params/SeqGroupIndexVector.java index 0c78e85..5c25b47 100644 --- a/src/jalview/ws/rest/params/SeqGroupIndexVector.java +++ b/src/jalview/ws/rest/params/SeqGroupIndexVector.java @@ -171,7 +171,7 @@ public class SeqGroupIndexVector extends InputType implements int[] srt = new int[gl.size()]; for (int i = 0; i < vals.length; i++) srt[i] = vals[i][0]; - jalview.util.QuickSort.sort(srt, vals); + jalview.util.QuickSort.sortInt(srt, vals); list = false; int last = vals[0][0] - 1; for (int[] range : vals) diff --git a/test/jalview/util/QuickSortTest.java b/test/jalview/util/QuickSortTest.java index fac463a..d022269 100644 --- a/test/jalview/util/QuickSortTest.java +++ b/test/jalview/util/QuickSortTest.java @@ -35,7 +35,7 @@ public class QuickSortTest { int[] values = new int[] { 3, 2, 4, 1 }; - QuickSort.sort(values, things); + QuickSort.sortInt(values, things); assertTrue(Arrays.equals(new int[] { 1, 2, 3, 4 }, values)); assertTrue(Arrays.equals(sortedThings, things)); @@ -46,7 +46,7 @@ public class QuickSortTest { float[] values = new float[] { 3f, 2f, 4f, 1f }; - QuickSort.sort(values, things); + QuickSort.sortFloat(values, things); assertTrue(Arrays.equals(new float[] { 1f, 2f, 3f, 4f }, values)); assertTrue(Arrays.equals(sortedThings, things)); @@ -57,7 +57,7 @@ public class QuickSortTest { double[] values = new double[] { 3d, 2d, 4d, 1d }; - QuickSort.sort(values, things); + QuickSort.sortDouble(values, things); assertTrue(Arrays.equals(new double[] { 1d, 2d, 3d, 4d }, values)); assertTrue(Arrays.equals(sortedThings, things)); @@ -88,7 +88,7 @@ public class QuickSortTest int[] values = new int[] { 3, 4, 2, 4, 1 }; Object [] things = new Object [] {"A", "X", "Y", "B", "Z"}; - QuickSort.sort(values, things); + QuickSort.sortInt(values, things); assertTrue(Arrays.equals(new int[] { 1, 2, 3, 4, 4 }, values)); // this fails - do we care? @@ -112,7 +112,7 @@ public class QuickSortTest counts[43] = 16; counts[59] = 7; counts[62] = 2; - QuickSort.sort(counts, residues); + QuickSort.sortFloat(counts, residues); assertEquals(43, residues[63]); assertEquals(59, residues[62]); assertEquals(62, residues[61]);