Commit 2799dae9 authored by edmundszagars's avatar edmundszagars
Browse files

Refactoring getData(ArrayList) method

parent 98b14750
......@@ -21,12 +21,14 @@ public class MainWindow extends Application {
private FileChooser fileChooser = new FileChooser();
private String filePath;
private ArrayList list;
private TableView<Result> table = new TableView();
ArrayList<Result> results = new ArrayList<>();
private TableView<Result> table;
private ArrayList<Result> results = new ArrayList<>();
@Override
public void start(Stage primaryStage) {
results.add(new Result(new double[]{1,1,1,1},new double[]{1,1,1,1},01111));
Label label = new Label("Select file location: ");
TextField fileLocation = new TextField();
......@@ -71,6 +73,7 @@ public class MainWindow extends Application {
table = new TableView<>();
table.getColumns().addAll(dataColumn,resultDataColumn,timeColumn);
//table.setItems(getResults(results));
Button startButton = new Button("Run tests");
startButton.setOnAction(event -> {
......@@ -85,8 +88,7 @@ public class MainWindow extends Application {
double[] ar = dataFromCSV.getDoubleArrayFromListItem((ArrayList) list.get(0));
double[] resultarr = BubbleSort.bubbleSort(ar);
System.out.println("Bouble sort will be executed");
table.setItems(getResults());
System.out.println(BubbleSort.getBubbleSortExecutionResult());
}
});
......@@ -109,9 +111,9 @@ public class MainWindow extends Application {
primaryStage.show();
}
public ObservableList<Result> getResults(){
public ObservableList<Result> getResults(ArrayList<Result> resultArrayList){
ObservableList<Result> results = FXCollections.observableArrayList();
results.add(new Result(new double[]{1,2,3},new double[]{1,2,3},BubbleSort.getBubbleSortExecutionResult()));
results.addAll(this.results);
return results;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment