much implementation, ready for first test
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user