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