much implementation, ready for first test

This commit is contained in:
2020-05-30 18:46:10 -05:00
parent 741d29f148
commit c680ec7671
8 changed files with 159 additions and 11 deletions

View File

@@ -10,11 +10,13 @@ import java.lang.Integer;
*/
abstract class Sorter {
protected String sortType;
protected Integer[] numbers;
protected long swapsUsed = 0;
protected long comparisonsUsed = 0;
public Sorter(String filename){
public Sorter(String st, String filename){
sortType=st;
RandomNumberFileReader reader = new RandomNumberFileReader(filename);
reader.getNumbers().toArray(numbers);
}
@@ -43,7 +45,7 @@ abstract class Sorter {
this.sort();
Instant end = Instant.now();
Duration time = Duration.between(start,end);
SortResult output = new SortResult(numbers, comparisonsUsed, swapsUsed, time);
SortResult output = new SortResult(sortType, numbers, comparisonsUsed, swapsUsed, time);
return output;
}