Added javadocs.
This commit is contained in:
@@ -23,7 +23,6 @@ public class Airport {
|
|||||||
private Country country;
|
private Country country;
|
||||||
private ArrayList<Route> departureRoutes = new ArrayList<Route>();
|
private ArrayList<Route> departureRoutes = new ArrayList<Route>();
|
||||||
private ArrayList<Route> arrivalRoutes = new ArrayList<Route>();
|
private ArrayList<Route> arrivalRoutes = new ArrayList<Route>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param ID from the database
|
* @param ID from the database
|
||||||
|
|||||||
@@ -19,9 +19,11 @@ import seng202.group9.Core.RoutePath;
|
|||||||
import seng202.group9.Map.Map;
|
import seng202.group9.Map.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Controller for the Airline summary scene.
|
||||||
* Created by michael on 14/09/2016.
|
* Created by michael on 14/09/2016.
|
||||||
*/
|
*/
|
||||||
public class AirlineSummaryController extends Controller{
|
public class AirlineSummaryController extends Controller{
|
||||||
|
//links the fxml to the controller.
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<Airline> tableView;
|
private TableView<Airline> tableView;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -37,11 +39,16 @@ public class AirlineSummaryController extends Controller{
|
|||||||
@FXML
|
@FXML
|
||||||
private TableColumn<Airline, String> columnIATA;
|
private TableColumn<Airline, String> columnIATA;
|
||||||
|
|
||||||
|
//Holds data used for the table.
|
||||||
private Dataset currentData = null;
|
private Dataset currentData = null;
|
||||||
|
|
||||||
private Map map;
|
private Map map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads initial state of the scene.
|
||||||
|
*/
|
||||||
public void load() {
|
public void load() {
|
||||||
|
//Fills the table.
|
||||||
columnName.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
|
columnName.setCellValueFactory(new PropertyValueFactory<Airline, String>("Name"));
|
||||||
columnAlias.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
|
columnAlias.setCellValueFactory(new PropertyValueFactory<Airline, String>("Alias"));
|
||||||
columnCountry.setCellValueFactory(new PropertyValueFactory<Airline, String>("CountryName"));
|
columnCountry.setCellValueFactory(new PropertyValueFactory<Airline, String>("CountryName"));
|
||||||
@@ -49,6 +56,7 @@ public class AirlineSummaryController extends Controller{
|
|||||||
columnActive.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
|
columnActive.setCellValueFactory(new PropertyValueFactory<Airline, String>("Active"));
|
||||||
currentData = getParent().getCurrentDataset();
|
currentData = getParent().getCurrentDataset();
|
||||||
tableView.setItems(FXCollections.observableArrayList(currentData.getAirlines()));
|
tableView.setItems(FXCollections.observableArrayList(currentData.getAirlines()));
|
||||||
|
//Sets up map.
|
||||||
map = new Map(mapView, new RoutePath());
|
map = new Map(mapView, new RoutePath());
|
||||||
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Airline>() {
|
tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Airline>() {
|
||||||
public void changed(ObservableValue<? extends Airline> observable, Airline oldValue, Airline newValue) {
|
public void changed(ObservableValue<? extends Airline> observable, Airline oldValue, Airline newValue) {
|
||||||
@@ -63,15 +71,30 @@ public class AirlineSummaryController extends Controller{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the scene to the Airline raw data scene.
|
||||||
|
*/
|
||||||
public void airlineRawDataButton() {
|
public void airlineRawDataButton() {
|
||||||
replaceSceneContent(SceneCode.AIRLINE_RAW_DATA);
|
replaceSceneContent(SceneCode.AIRLINE_RAW_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the scene to the Flight summary scene.
|
||||||
|
*/
|
||||||
public void flightSummaryButton() {
|
public void flightSummaryButton() {
|
||||||
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
|
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the scene to the Airport summary scene.
|
||||||
|
*/
|
||||||
public void airportSummaryButton() {
|
public void airportSummaryButton() {
|
||||||
replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
|
replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the scene to the Route summary scene.
|
||||||
|
*/
|
||||||
public void routeSummaryButton() {
|
public void routeSummaryButton() {
|
||||||
replaceSceneContent(SceneCode.ROUTE_SUMMARY);
|
replaceSceneContent(SceneCode.ROUTE_SUMMARY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,32 +14,48 @@ import javafx.collections.FXCollections;
|
|||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.scene.chart.*;
|
import javafx.scene.chart.*;
|
||||||
import javafx.scene.Group;
|
import javafx.scene.Group;
|
||||||
|
import seng202.group9.Core.Airport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gui controller class currently for creating the bar graph of routes arriving and departing from airports.
|
||||||
|
* Extend the class. {@link Controller}
|
||||||
* Created by michael on 17/09/2016.
|
* Created by michael on 17/09/2016.
|
||||||
*/
|
*/
|
||||||
public class AirportAnalyser extends Controller {
|
public class AirportAnalyser extends Controller {
|
||||||
|
//links fxml parts to the controller.
|
||||||
@FXML
|
@FXML
|
||||||
PieChart pieGraph;
|
PieChart pieGraph;
|
||||||
|
|
||||||
|
//Used to store the data needed for making the graph.
|
||||||
private Dataset currentdata = null;
|
private Dataset currentdata = null;
|
||||||
private HashMap<String, Integer> useddata = new HashMap<String, Integer>();
|
private HashMap<String, Integer> useddata = new HashMap<String, Integer>();
|
||||||
|
private ArrayList<Airport> current_routes;
|
||||||
|
|
||||||
private ArrayList<Airline> current_routes;
|
/**
|
||||||
|
* Takes data from the current dataset and places it into the displayed pie graph.
|
||||||
|
*/
|
||||||
public void build_graph(){
|
public void build_graph(){
|
||||||
current_routes = currentdata.getAirlines();
|
//Takes Airports from the full dataset.
|
||||||
|
current_routes = currentdata.getAirports();
|
||||||
datasetup(current_routes);
|
datasetup(current_routes);
|
||||||
|
//Turns the data into a usable list.
|
||||||
ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList();
|
ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList();
|
||||||
System.out.println(useddata.keySet().size());
|
System.out.println(useddata.keySet().size());
|
||||||
for (String airport : useddata.keySet()){
|
for (String airport : useddata.keySet()){
|
||||||
Integer temp = useddata.get(airport);
|
Integer temp = useddata.get(airport);
|
||||||
pieChartData.add(new PieChart.Data(airport,temp));
|
pieChartData.add(new PieChart.Data(airport,temp));
|
||||||
}
|
}
|
||||||
|
//Gives the data to the graph.
|
||||||
pieGraph.setData(pieChartData);
|
pieGraph.setData(pieChartData);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void datasetup(ArrayList<Airline> current_routes){
|
/**
|
||||||
for (Airline entry : current_routes){
|
* Takes the raw list of routes and fills the used data dictionary with the appropriate data to be displayed
|
||||||
|
* @param current_air_ports
|
||||||
|
*/
|
||||||
|
private void datasetup(ArrayList<Airport> current_air_ports){
|
||||||
|
//Takes out the specified field then adds to the used data dict.
|
||||||
|
for (Airport entry : current_air_ports){
|
||||||
String name = entry.getCountryName();
|
String name = entry.getCountryName();
|
||||||
if (useddata.containsKey(name)){
|
if (useddata.containsKey(name)){
|
||||||
int temp = useddata.get(name);
|
int temp = useddata.get(name);
|
||||||
@@ -51,6 +67,9 @@ public class AirportAnalyser extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes the current dataset then loads the data to the graph using build graph.
|
||||||
|
*/
|
||||||
public void load() {
|
public void load() {
|
||||||
currentdata = getParent().getCurrentDataset();
|
currentdata = getParent().getCurrentDataset();
|
||||||
build_graph();
|
build_graph();
|
||||||
|
|||||||
@@ -17,9 +17,11 @@ import seng202.group9.Core.RoutePath;
|
|||||||
import seng202.group9.Map.Map;
|
import seng202.group9.Map.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Controller for the Airport summary scene.
|
||||||
* Created by michael on 14/09/2016.
|
* Created by michael on 14/09/2016.
|
||||||
*/
|
*/
|
||||||
public class AirportSummaryController extends Controller{
|
public class AirportSummaryController extends Controller{
|
||||||
|
//links controller to fxml.
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<Airport> tableView;
|
private TableView<Airport> tableView;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -35,23 +37,41 @@ public class AirportSummaryController extends Controller{
|
|||||||
@FXML
|
@FXML
|
||||||
private TableColumn<Airport, String> columnIATA;
|
private TableColumn<Airport, String> columnIATA;
|
||||||
|
|
||||||
|
//Stores required data.
|
||||||
private Dataset currentData = null;
|
private Dataset currentData = null;
|
||||||
|
|
||||||
private Map map;
|
private Map map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the scene to the Airport raw data scene.
|
||||||
|
*/
|
||||||
public void airportRawDataButton() {
|
public void airportRawDataButton() {
|
||||||
replaceSceneContent(SceneCode.AIRPORT_RAW_DATA);
|
replaceSceneContent(SceneCode.AIRPORT_RAW_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the scene to the flight summary scene.
|
||||||
|
*/
|
||||||
public void flightSummaryButton() {
|
public void flightSummaryButton() {
|
||||||
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
|
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the scene to the Route summary scene.
|
||||||
|
*/
|
||||||
public void routeSummaryButton() {
|
public void routeSummaryButton() {
|
||||||
replaceSceneContent(SceneCode.ROUTE_SUMMARY);
|
replaceSceneContent(SceneCode.ROUTE_SUMMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the scene to the airline summary scene.
|
||||||
|
*/
|
||||||
public void airlineSummaryButton() {
|
public void airlineSummaryButton() {
|
||||||
replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
|
replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads initial state of the scene.
|
||||||
|
*/
|
||||||
public void load() {
|
public void load() {
|
||||||
currentData = getParent().getCurrentDataset();
|
currentData = getParent().getCurrentDataset();
|
||||||
columnName.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
|
columnName.setCellValueFactory(new PropertyValueFactory<Airport, String>("Name"));
|
||||||
|
|||||||
@@ -21,9 +21,11 @@ import javafx.scene.chart.*;
|
|||||||
import javafx.scene.Group;
|
import javafx.scene.Group;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Controls the calculate airport distance scene and extends {@link Controller}
|
||||||
* Created by michael on 17/09/2016.
|
* Created by michael on 17/09/2016.
|
||||||
*/
|
*/
|
||||||
public class DistCalcController extends Controller {
|
public class DistCalcController extends Controller {
|
||||||
|
//Connects controller to fxml.
|
||||||
@FXML
|
@FXML
|
||||||
ListView<String> airportOne;
|
ListView<String> airportOne;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -31,10 +33,14 @@ public class DistCalcController extends Controller {
|
|||||||
@FXML
|
@FXML
|
||||||
Label answerBox;
|
Label answerBox;
|
||||||
|
|
||||||
|
//Stores requsite data for calulating and populating tables.
|
||||||
Dataset currentData = null;
|
Dataset currentData = null;
|
||||||
HashMap<String, Airport> current_Airports;
|
HashMap<String, Airport> current_Airports;
|
||||||
SimpleStringProperty bound = new SimpleStringProperty("Answer");
|
SimpleStringProperty bound = new SimpleStringProperty("Answer");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fills the list views with the current airports.
|
||||||
|
*/
|
||||||
private void fill_boxes(){
|
private void fill_boxes(){
|
||||||
HashMap<String, Airport> current_Airports = currentData.getAirportDictionary();
|
HashMap<String, Airport> current_Airports = currentData.getAirportDictionary();
|
||||||
ArrayList<String> names = new ArrayList<String>();
|
ArrayList<String> names = new ArrayList<String>();
|
||||||
@@ -46,6 +52,9 @@ public class DistCalcController extends Controller {
|
|||||||
airportTwo.setItems(usablenames);
|
airportTwo.setItems(usablenames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes thetwo selected airports from the list views and calculated the distance between.
|
||||||
|
*/
|
||||||
public void calculateButton(){
|
public void calculateButton(){
|
||||||
Airport airport1 = currentData.getAirports().get((airportOne.getSelectionModel().getSelectedIndices().get(0)));
|
Airport airport1 = currentData.getAirports().get((airportOne.getSelectionModel().getSelectedIndices().get(0)));
|
||||||
Airport airport2 = currentData.getAirports().get((airportTwo.getSelectionModel().getSelectedIndices().get(0)));
|
Airport airport2 = currentData.getAirports().get((airportTwo.getSelectionModel().getSelectedIndices().get(0)));
|
||||||
@@ -54,6 +63,9 @@ public class DistCalcController extends Controller {
|
|||||||
System.out.println(bound);
|
System.out.println(bound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the initial state of the scene.
|
||||||
|
*/
|
||||||
public void load(){
|
public void load(){
|
||||||
currentData = getParent().getCurrentDataset();
|
currentData = getParent().getCurrentDataset();
|
||||||
answerBox.textProperty().bind(bound);
|
answerBox.textProperty().bind(bound);
|
||||||
|
|||||||
@@ -12,20 +12,28 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gui controller class currently for creating the bar graph of routes arriving and departing from airports.
|
||||||
|
* Extend the class. {@link Controller}
|
||||||
* Created by michael on 16/09/2016.
|
* Created by michael on 16/09/2016.
|
||||||
*/
|
*/
|
||||||
public class RouteAnalyser extends Controller {
|
public class RouteAnalyser extends Controller {
|
||||||
|
//Links fxml to the controller.
|
||||||
@FXML
|
@FXML
|
||||||
private BarChart analyserGraph;
|
private BarChart analyserGraph;
|
||||||
|
|
||||||
|
//Used to store the data needed for making the tables.
|
||||||
private ArrayList<Route> current_routes;
|
private ArrayList<Route> current_routes;
|
||||||
|
|
||||||
private Dataset currentdata = null;
|
private Dataset currentdata = null;
|
||||||
private HashMap<String, ArrayList> useddata = new HashMap<String, ArrayList>();
|
private HashMap<String, ArrayList> useddata = new HashMap<String, ArrayList>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes data from the current dataset and places it into the displayed bar graph.
|
||||||
|
*/
|
||||||
public void build_graph(){
|
public void build_graph(){
|
||||||
|
//Takes routes from the full dataset.
|
||||||
current_routes = currentdata.getRoutes();
|
current_routes = currentdata.getRoutes();
|
||||||
datasetup(current_routes);
|
datasetup(current_routes);
|
||||||
|
//Builds series needed for the graph.
|
||||||
XYChart.Series seriesArivals = new XYChart.Series();
|
XYChart.Series seriesArivals = new XYChart.Series();
|
||||||
XYChart.Series seriesDeparts = new XYChart.Series();
|
XYChart.Series seriesDeparts = new XYChart.Series();
|
||||||
seriesArivals.setName("Arriving routes");
|
seriesArivals.setName("Arriving routes");
|
||||||
@@ -36,10 +44,17 @@ public class RouteAnalyser extends Controller {
|
|||||||
seriesArivals.getData().add(new XYChart.Data(airport,temp.get(0)));
|
seriesArivals.getData().add(new XYChart.Data(airport,temp.get(0)));
|
||||||
seriesDeparts.getData().add(new XYChart.Data(airport,temp.get(1)));
|
seriesDeparts.getData().add(new XYChart.Data(airport,temp.get(1)));
|
||||||
}
|
}
|
||||||
|
//Gives the formatted data to the graph.
|
||||||
analyserGraph.getData().addAll(seriesArivals,seriesDeparts);
|
analyserGraph.getData().addAll(seriesArivals,seriesDeparts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes the raw list of routes and fills the used data dictionary with the appropriate data to be displayed
|
||||||
|
* @param current_routes
|
||||||
|
*/
|
||||||
|
|
||||||
private void datasetup(ArrayList<Route> current_routes){
|
private void datasetup(ArrayList<Route> current_routes){
|
||||||
|
//Takes out the specified field (Currently departure airport and arrival airport) then adds to the used data dict.
|
||||||
for (Route entry : current_routes){
|
for (Route entry : current_routes){
|
||||||
String departs = entry.getDepartureAirport();
|
String departs = entry.getDepartureAirport();
|
||||||
String arives = entry.getArrivalAirport();
|
String arives = entry.getArrivalAirport();
|
||||||
@@ -66,6 +81,9 @@ public class RouteAnalyser extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes the current dataset then loads the data to the graph using build graph.
|
||||||
|
*/
|
||||||
public void load() {
|
public void load() {
|
||||||
currentdata = getParent().getCurrentDataset();
|
currentdata = getParent().getCurrentDataset();
|
||||||
build_graph();
|
build_graph();
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ public class RouteSummaryController extends Controller{
|
|||||||
|
|
||||||
private Dataset currentData = null;
|
private Dataset currentData = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads initial state of the scene.
|
||||||
|
*/
|
||||||
public void load() {
|
public void load() {
|
||||||
columnAirline.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName"));
|
columnAirline.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineName"));
|
||||||
columnDepart.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
|
columnDepart.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
|
||||||
@@ -69,15 +72,31 @@ public class RouteSummaryController extends Controller{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the scene to the route raw data scene.
|
||||||
|
*/
|
||||||
public void routeRawDataButton() {
|
public void routeRawDataButton() {
|
||||||
replaceSceneContent(SceneCode.ROUTE_RAW_DATA);
|
replaceSceneContent(SceneCode.ROUTE_RAW_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the scene to the flight summary scene.
|
||||||
|
*/
|
||||||
public void flightSummaryButton() {
|
public void flightSummaryButton() {
|
||||||
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
|
replaceSceneContent(SceneCode.FLIGHT_SUMMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the scene to the airport summary scene.
|
||||||
|
*/
|
||||||
public void airportSummaryButton() {
|
public void airportSummaryButton() {
|
||||||
replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
|
replaceSceneContent(SceneCode.AIRPORT_SUMMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the scene to the airline summary scene.
|
||||||
|
*/
|
||||||
public void airlineSummaryButton() {
|
public void airlineSummaryButton() {
|
||||||
replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
|
replaceSceneContent(SceneCode.AIRLINE_SUMMARY);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user