Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Edmunds Žagars
Java_course_final
Commits
2799dae9
Commit
2799dae9
authored
Mar 30, 2018
by
edmundszagars
Browse files
Refactoring getData(ArrayList) method
parent
98b14750
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
src/gui/MainWindow.java
src/gui/MainWindow.java
+8
-6
No files found.
src/gui/MainWindow.java
View file @
2799dae9
...
...
@@ -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
.
getBubbleSortExecutionR
esult
())
);
results
.
add
All
(
this
.
r
esult
s
);
return
results
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment