get sort count for numbers or words
This commit is contained in:
@@ -27,8 +27,10 @@ public class SortResult {
|
|||||||
private String comparisonsUsed;
|
private String comparisonsUsed;
|
||||||
private String writesUsed;
|
private String writesUsed;
|
||||||
private String timeUsed;
|
private String timeUsed;
|
||||||
|
private boolean sortingNumbers;
|
||||||
|
|
||||||
public SortResult(String st, Integer[] a, long c, long w, Duration t){
|
public SortResult(String st, Integer[] a, long c, long w, Duration t){
|
||||||
|
sortingNumbers = true;
|
||||||
sortType = st;
|
sortType = st;
|
||||||
sortedArray = a;
|
sortedArray = a;
|
||||||
NumberFormat nf = NumberFormat.getInstance(Locale.US);
|
NumberFormat nf = NumberFormat.getInstance(Locale.US);
|
||||||
@@ -43,6 +45,7 @@ public class SortResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SortResult(String st, String[] a, long c, long w, Duration t){
|
public SortResult(String st, String[] a, long c, long w, Duration t){
|
||||||
|
sortingNumbers = false;
|
||||||
sortType = st;
|
sortType = st;
|
||||||
sortedWordArray = a;
|
sortedWordArray = a;
|
||||||
NumberFormat nf = NumberFormat.getInstance(Locale.US);
|
NumberFormat nf = NumberFormat.getInstance(Locale.US);
|
||||||
@@ -91,8 +94,13 @@ public class SortResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getSortCount(){
|
public String getSortCount(){
|
||||||
NumberFormat nf = NumberFormat.getInstance(Locale.US);
|
if(sortingNumbers){
|
||||||
return nf.format(sortedWordArray.length);
|
NumberFormat nf = NumberFormat.getInstance(Locale.US);
|
||||||
|
return nf.format(sortedArray.length);
|
||||||
|
} else {
|
||||||
|
NumberFormat nf = NumberFormat.getInstance(Locale.US);
|
||||||
|
return nf.format(sortedWordArray.length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMin(){
|
public String getMin(){
|
||||||
|
|||||||
Reference in New Issue
Block a user