.append(((c == 0) ? "" : "; "))
.append(alphabet[c])
.append(" ")
- .append(((fmt != null) ? fmt.form(tval) : ((int) tval)))
+ .append(((fmt != null) ? fmt.formDouble(tval) : ((int) tval)))
.append("%");
}
}
// { (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];
.append((((p == 0) ? "" : "; ")))
.append(residue)
.append(" ")
- .append(((fmt != null) ? fmt.form(tval)
+ .append(((fmt != null) ? fmt.formDouble(tval)
: ((int) tval))).append("%");
p++;
}
else
{
mouseOver.append(
- (((fmt != null) ? fmt.form(value) : ((int) value))))
+ (((fmt != null) ? fmt.formDouble(value) : ((int) value))))
.append("%");
}
consensus.annotations[i] = new Annotation(maxRes,
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;
{
codons[i] = (char) i;
}
- QuickSort.sort(sortedCounts, codons);
+ QuickSort.sortInt(sortedCounts, codons);
int totalPercentage = 0;
int distinctValuesCount = 0;
int j = 3;
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];
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)
pid = pid / (aseq1.length - count) * 100;
output = output.append(new Format("Percentage ID = %2.2f\n\n")
- .form(pid));
+ .formDouble(pid));
try
{
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();
seqs[i] = align.getSequenceAt(i);
}
- QuickSort.sort(scores, seqs);
+ QuickSort.sortFloat(scores, seqs);
setReverseOrder(align, seqs);
}
length[i] = (seqs[i].getEnd() - seqs[i].getStart());
}
- QuickSort.sort(length, seqs);
+ QuickSort.sortFloat(length, seqs);
if (sortLengthAscending)
{
.floatValue();
}
- jalview.util.QuickSort.sort(ids, alignment);
+ jalview.util.QuickSort.sortFloat(ids, alignment);
}
/**
}
}
- jalview.util.QuickSort.sort(scores, seqs);
+ jalview.util.QuickSort.sortDouble(scores, seqs);
if (lastSortByScore != scoreLabel)
{
lastSortByScore = scoreLabel;
}
}
- jalview.util.QuickSort.sort(scores, seqs);
+ jalview.util.QuickSort.sortDouble(scores, seqs);
}
else if (method == FEATURE_DENSITY)
{
// 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
{
x++;
}
}
- jalview.util.QuickSort.sort(vl, ca);
+ jalview.util.QuickSort.sortFloat(vl, ca);
int p = 0;
/*
{
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++;
}
else
{
- mouseOver += (fmt.form(value) + "%");
+ mouseOver += (fmt.formDouble(value) + "%");
}
consensus.annotations[i] = new Annotation(maxRes, mouseOver, ' ',
value);
x++;
}
}
- jalview.util.QuickSort.sort(vl, ca);
+ jalview.util.QuickSort.sortFloat(vl, ca);
int valuesCount = 0;
rtnval[1] = 0;
{
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);
}
}
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();
}
String nodeLabel = "";
if (showDistances && node.dist > 0)
{
- nodeLabel = new Format("%-.2f").form(node.dist);
+ nodeLabel = new Format("%-.2f").formDouble(node.dist);
}
if (showBootstrap)
{
if (showDistances && (node.dist > 0))
{
- nodeLabel = new Format("%-.2f").form(node.dist);
+ nodeLabel = new Format("%-.2f").formDouble(node.dist);
}
if (showBootstrap)
}
if (sort)
{
- jalview.util.QuickSort.sort(order, data);
+ jalview.util.QuickSort.sortFloat(order, data);
}
}
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;
}
if (sort)
{
- jalview.util.QuickSort.sort(width, data);
+ jalview.util.QuickSort.sortFloat(width, data);
// update global priority order
}
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)
{
{
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);
}
}
if (showDistances && (node.dist > 0))
{
- nodeLabel = new Format("%-.2f").form(node.dist);
+ nodeLabel = new Format("%-.2f").formDouble(node.dist);
}
if (showBootstrap && node.bootstrap > -1)
if (showDistances && (node.dist > 0))
{
- nodeLabel = new Format("%-.2f").form(node.dist);
+ nodeLabel = new Format("%-.2f").formDouble(node.dist);
}
if (showBootstrap && node.bootstrap > -1)
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)
{
{
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();
{
for (int j = 0; j < rows; j++)
{
- Format.print(ps, "%15.4e", d[j]);
+ Format.printDouble(ps, "%15.4e", d[j]);
}
}
{
for (int j = 0; j < rows; j++)
{
- Format.print(ps, "%15.4e", e[j]);
+ Format.printDouble(ps, "%15.4e", e[j]);
}
}
* @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));
}
/**
* @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));
}
/**
* @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));
}
/**
* @exception IllegalArgumentException
* if bad argument
*/
- public String form(double x)
+ public String formDouble(double x)
{
String r;
* the number to format
* @return the formatted string
*/
- public String form(long x)
+ public String formLong(long x)
{
String r;
int s = 0;
* the value to format
* @return the formatted string
*/
- public String form(char c)
+ public String formChar(char c)
{
if (fmt != 'c')
{
}
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
* @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);
}
/**
* @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);
}
/**
* @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);
}
/**
}
}
- 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;
}
}
- 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;
}
}
- 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;
}
}
- 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;
* @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
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);
}
}
* @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
}
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);
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<Jws2Instance>();
for (Jws2Instance svc : svcs)
{
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)
{
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));
{
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));
{
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));
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?
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]);