Made route RD display things in the table and added functionality to the add button

main
Sunguin Peng 9 years ago
parent 8192c59bb4
commit ae522e14d3

@ -1,8 +1,6 @@
package seng202.group9.Controller; package seng202.group9.Controller;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import seng202.group9.Core.*; import seng202.group9.Core.*;
import java.sql.Connection; import java.sql.Connection;
@ -593,15 +591,15 @@ public class Dataset {
" `Codeshare`, `Stops`, `Equipment`) VALUES "; " `Codeshare`, `Stops`, `Equipment`) VALUES ";
int numOfRoutes = 0; int numOfRoutes = 0;
for (int i = 0; i < routesToImport.size(); i ++){ for (int i = 0; i < routesToImport.size(); i ++){
String routeIdentifier = routesToImport.get(i).getAirline() + routesToImport.get(i).departsFrom() + routesToImport.get(i).arrivesAt() + String routeIdentifier = routesToImport.get(i).getAirline() + routesToImport.get(i).getDepartureAirport() + routesToImport.get(i).getArrivalAirport() +
routesToImport.get(i).getCode() + routesToImport.get(i).getStops() + routesToImport.get(i).getEquipment(); routesToImport.get(i).getCode() + routesToImport.get(i).getStops() + routesToImport.get(i).getEquipment();
if (routeDictionary.containsKey(routeIdentifier)){ if (routeDictionary.containsKey(routeIdentifier)){
numOfDuplicates ++; numOfDuplicates ++;
}else{ }else{
//route variables //route variables
String routeAirline = routesToImport.get(i).getAirline().replace("\"", "\"\""); String routeAirline = routesToImport.get(i).getAirline().replace("\"", "\"\"");
String routeSource = routesToImport.get(i).departsFrom().replace("\"", "\"\""); String routeSource = routesToImport.get(i).getDepartureAirport().replace("\"", "\"\"");
String routeDestination = routesToImport.get(i).arrivesAt().replace("\"", "\"\""); String routeDestination = routesToImport.get(i).getArrivalAirport().replace("\"", "\"\"");
String routeCode = routesToImport.get(i).getCode().replace("\"", "\"\""); String routeCode = routesToImport.get(i).getCode().replace("\"", "\"\"");
int routeStops = routesToImport.get(i).getStops(); int routeStops = routesToImport.get(i).getStops();
String routeEquipment = routesToImport.get(i).getEquipment().replace("\"", "\"\""); String routeEquipment = routesToImport.get(i).getEquipment().replace("\"", "\"\"");
@ -934,10 +932,10 @@ public class Dataset {
if (routeToAdd.getAirline().length() != 2 && routeToAdd.getAirline().length() != 3){ if (routeToAdd.getAirline().length() != 2 && routeToAdd.getAirline().length() != 3){
throw new DataException("Airline ICAO code must be 2 or 3 letters."); throw new DataException("Airline ICAO code must be 2 or 3 letters.");
} }
if (routeToAdd.departsFrom().length() != 3 && routeToAdd.departsFrom().length() != 4){ if (routeToAdd.getDepartureAirport().length() != 3 && routeToAdd.getDepartureAirport().length() != 4){
throw new DataException("Airport Source Airport IATA must be 3 letters or 4 letters if ICAO."); throw new DataException("Airport Source Airport IATA must be 3 letters or 4 letters if ICAO.");
} }
if (routeToAdd.arrivesAt().length() != 3 && routeToAdd.arrivesAt().length() != 4){ if (routeToAdd.getArrivalAirport().length() != 3 && routeToAdd.getArrivalAirport().length() != 4){
throw new DataException("Airport Destination Airport IATA must be 3 letters or 4 letters if ICAO."); throw new DataException("Airport Destination Airport IATA must be 3 letters or 4 letters if ICAO.");
} }
if (routeToAdd.getCode().length() != 0 && routeToAdd.getCode().length() != 1){ if (routeToAdd.getCode().length() != 0 && routeToAdd.getCode().length() != 1){
@ -956,8 +954,8 @@ public class Dataset {
//add the airline //add the airline
stmt = c.createStatement(); stmt = c.createStatement();
String airline = routeToAdd.getAirline().replace("\"", "\"\""); String airline = routeToAdd.getAirline().replace("\"", "\"\"");
String sourceAir = routeToAdd.departsFrom().replace("\"", "\"\""); String sourceAir = routeToAdd.getDepartureAirport().replace("\"", "\"\"");
String destAir = routeToAdd.arrivesAt().replace("\"", "\"\""); String destAir = routeToAdd.getArrivalAirport().replace("\"", "\"\"");
String equipment = routeToAdd.getEquipment().replace("\"", "\"\""); String equipment = routeToAdd.getEquipment().replace("\"", "\"\"");
String insertRouteQuery = "INSERT INTO `" + this.name + "_Routes` (`Airline`, `Source_Airport`, `Destination_Airport`," + String insertRouteQuery = "INSERT INTO `" + this.name + "_Routes` (`Airline`, `Source_Airport`, `Destination_Airport`," +
" `Codeshare`, `Stops`, `Equipment`) VALUES (\""+airline+"\", \""+sourceAir+"\", \""+destAir+"\", " + " `Codeshare`, `Stops`, `Equipment`) VALUES (\""+airline+"\", \""+sourceAir+"\", \""+destAir+"\", " +
@ -974,7 +972,7 @@ public class Dataset {
routeToAdd.setID(routeID); routeToAdd.setID(routeID);
routes.add(routeToAdd); routes.add(routeToAdd);
//routeAirline + routeSourceAirport + routeArrvAirport + routeCodeShare + routeStops + routeEquip //routeAirline + routeSourceAirport + routeArrvAirport + routeCodeShare + routeStops + routeEquip
String routeKey = routeToAdd.getAirline() + routeToAdd.departsFrom() + routeToAdd.arrivesAt() + routeToAdd.getCode() + routeToAdd.getStops() + routeToAdd.getEquipment(); String routeKey = routeToAdd.getAirline() + routeToAdd.getDepartureAirport() + routeToAdd.getArrivalAirport() + routeToAdd.getCode() + routeToAdd.getStops() + routeToAdd.getEquipment();
routeDictionary.put(routeKey, routeToAdd); routeDictionary.put(routeKey, routeToAdd);
} catch ( Exception e ) { } catch ( Exception e ) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.err.println( e.getClass().getName() + ": " + e.getMessage() );

@ -148,14 +148,14 @@ public class Route {
* returns the source airport of this route * returns the source airport of this route
* @return * @return
*/ */
public String departsFrom(){ public String getDepartureAirport(){
return departureAirport; return departureAirport;
} }
/** /**
* returns the target airport of this route. * returns the target airport of this route.
* @return * @return
*/ */
public String arrivesAt(){ public String getArrivalAirport(){
return arrivalAirport; return arrivalAirport;
} }
@ -164,8 +164,8 @@ public class Route {
*/ */
public void hasDuplicate(Route route) throws DataException{ public void hasDuplicate(Route route) throws DataException{
//routeAirline + routeSourceAirport + routeArrvAirport + routeCodeShare + routeStops + routeEquip //routeAirline + routeSourceAirport + routeArrvAirport + routeCodeShare + routeStops + routeEquip
if (route.getAirline().equals(this.airline) && route.departsFrom().equals(this.departureAirport) if (route.getAirline().equals(this.airline) && route.getDepartureAirport().equals(this.departureAirport)
&& route.arrivesAt().equals(this.arrivalAirport) && route.getCode().equals(this.codeShare) && route.getArrivalAirport().equals(this.arrivalAirport) && route.getCode().equals(this.codeShare)
&& route.getStops() == this.stops && route.getEquipment().equals(this.equipment)){ && route.getStops() == this.stops && route.getEquipment().equals(this.equipment)){
throw new DataException("This Route already exists."); throw new DataException("This Route already exists.");
} }

@ -141,7 +141,7 @@ public class AirportRDController extends MenuController{
tableViewAirportRD.setItems(FXCollections.observableArrayList(theDataSet.getAirports())); tableViewAirportRD.setItems(FXCollections.observableArrayList(theDataSet.getAirports()));
} catch ( Exception e ) { } catch ( Exception e ) {
Alert alert = new Alert(Alert.AlertType.ERROR); Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Airline Data Error"); alert.setTitle("Airport Data Error");
alert.setHeaderText("Error adding a custom airport entry."); alert.setHeaderText("Error adding a custom airport entry.");
alert.setContentText(e.getMessage()); alert.setContentText(e.getMessage());
alert.showAndWait(); alert.showAndWait();

@ -59,7 +59,7 @@ public class MenuController implements Initializable{
try { try {
RouteRDController summaryController = (RouteRDController) parent.replaceSceneContent("route_raw_data.fxml"); RouteRDController summaryController = (RouteRDController) parent.replaceSceneContent("route_raw_data.fxml");
summaryController.setApp(parent); summaryController.setApp(parent);
//summaryController.loadTables(); summaryController.loadTables();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

@ -1,14 +1,109 @@
package seng202.group9.GUI; package seng202.group9.GUI;
import javafx.collections.FXCollections;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import seng202.group9.Controller.App; import seng202.group9.Controller.App;
import seng202.group9.Controller.Dataset;
import seng202.group9.Core.Airline;
import seng202.group9.Core.Route;
/** /**
* Created by Sunguin on 2016/09/14. * Created by Sunguin on 2016/09/14.
*/ */
public class RouteRDController extends MenuController { public class RouteRDController extends MenuController {
@FXML
private TableView<Route> tableViewRouteRD;
@FXML
private TableColumn<Route, String> rAirlineCol;
@FXML
private TableColumn<Route, String> rAirlineIDCol;
@FXML
private TableColumn<Route, String> rSourceCol;
@FXML
private TableColumn<Route, String> rSourceIDCol;
@FXML
private TableColumn<Route, String> rDestCol;
@FXML
private TableColumn<Route, String> rDestIDCol;
@FXML
private TableColumn<Route, String> rCodeshareCol;
@FXML
private TableColumn<Route, String> rStopsCol;
@FXML
private TableColumn<Route, String> rEquipmentCol;
@FXML
private TextField rAirlineBox;
@FXML
private TextField rAirlineIDBox;
@FXML
private TextField rSourceBox;
@FXML
private TextField rSourceIDBox;
@FXML
private TextField rDestBox;
@FXML
private TextField rDestIDBox;
@FXML
private TextField rCodeshareBox;
@FXML
private TextField rStopsBox;
@FXML
private TextField rEquipmentBox;
App parent; App parent;
public void setApp(App parent){ public void setApp(App parent){
this.parent = parent; this.parent = parent;
} }
private Dataset theDataSet = null;
public void loadTables() {
rAirlineCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Airline"));
//rAirlineIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("AirlineID"));
rSourceCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DepartureAirport"));
//rSourceIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("SourceID"));
rDestCol.setCellValueFactory(new PropertyValueFactory<Route, String>("ArrivalAirport"));
//rDestIDCol.setCellValueFactory(new PropertyValueFactory<Route, String>("DestID"));
rCodeshareCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Code"));
rStopsCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Stops"));
rEquipmentCol.setCellValueFactory(new PropertyValueFactory<Route, String>("Equipment"));
theDataSet = this.parent.getCurrentDataset();
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
}
public void addRouteSingle() {
try {
theDataSet.addRoute(
rAirlineBox.getText(),
rSourceBox.getText(),
rDestBox.getText(),
rCodeshareBox.getText(),
rStopsBox.getText(),
rEquipmentBox.getText()
);
rAirlineBox.clear();
rSourceBox.clear();
rDestBox.clear();
rCodeshareBox.clear();
rStopsBox.clear();
rEquipmentBox.clear();
tableViewRouteRD.setItems(FXCollections.observableArrayList(theDataSet.getRoutes()));
} catch ( Exception e ) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Route Data Error");
alert.setHeaderText("Error adding a custom route entry.");
alert.setContentText(e.getMessage());
alert.showAndWait();
}
}
} }

@ -23,18 +23,18 @@
<RowConstraints maxHeight="129.0" minHeight="10.0" prefHeight="111.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="129.0" minHeight="10.0" prefHeight="111.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<Pane prefHeight="410.0" prefWidth="773.0" GridPane.columnSpan="2"> <Pane prefHeight="410.0" prefWidth="800.0" GridPane.columnSpan="2">
<children> <children>
<Label layoutX="14.0" layoutY="14.0" text="Airline Raw Data"> <Label layoutX="14.0" layoutY="14.0" text="Airline Raw Data">
<font> <font>
<Font size="29.0" /> <Font size="29.0" />
</font> </font>
</Label> </Label>
<Button layoutX="10.0" layoutY="420.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" /> <Button layoutX="14.0" layoutY="412.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
<Button layoutX="661.0" layoutY="420.0" mnemonicParsing="false" onAction="#addAirlineSingle" prefHeight="25.0" prefWidth="125.0" text="Add" /> <Button layoutX="654.0" layoutY="412.0" mnemonicParsing="false" onAction="#addAirlineSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
<Pane layoutX="23.0" layoutY="60.0" prefHeight="309.0" prefWidth="757.0"> <Pane layoutX="14.0" layoutY="57.0" prefHeight="300.0" prefWidth="765.0">
<children> <children>
<TableView fx:id="tableView" layoutX="1.0" prefHeight="309.0" prefWidth="755.0"> <TableView fx:id="tableView" layoutX="1.0" prefHeight="300.0" prefWidth="765.0">
<columns> <columns>
<TableColumn fx:id="airlIDcol" prefWidth="83.0" text="Airline ID" /> <TableColumn fx:id="airlIDcol" prefWidth="83.0" text="Airline ID" />
<TableColumn fx:id="airlNamecol" prefWidth="137.0" text="Name" /> <TableColumn fx:id="airlNamecol" prefWidth="137.0" text="Name" />
@ -42,45 +42,45 @@
<TableColumn fx:id="airlIATAcol" minWidth="0.0" prefWidth="69.0" text="IATA" /> <TableColumn fx:id="airlIATAcol" minWidth="0.0" prefWidth="69.0" text="IATA" />
<TableColumn fx:id="airlICAOcol" minWidth="0.0" prefWidth="67.0" text="ICAO" /> <TableColumn fx:id="airlICAOcol" minWidth="0.0" prefWidth="67.0" text="ICAO" />
<TableColumn fx:id="airlCallsigncol" minWidth="0.0" prefWidth="93.0" text="Callsign" /> <TableColumn fx:id="airlCallsigncol" minWidth="0.0" prefWidth="93.0" text="Callsign" />
<TableColumn fx:id="airlCountrycol" minWidth="0.0" prefWidth="84.0" text="Country" /> <TableColumn fx:id="airlCountrycol" minWidth="0.0" prefWidth="102.0" text="Country" />
<TableColumn fx:id="airlActivecol" minWidth="8.0" prefWidth="92.0" text="Active" /> <TableColumn fx:id="airlActivecol" minWidth="8.0" prefWidth="84.0" text="Active" />
</columns> </columns>
</TableView> </TableView>
</children> </children>
</Pane> </Pane>
<Pane layoutX="23.0" layoutY="379.0" prefHeight="31.0" prefWidth="757.0"> <Pane layoutX="14.0" layoutY="365.0" prefHeight="31.0" prefWidth="765.0">
<children> <children>
<TextField fx:id="airlNameBox" layoutX="92.0" layoutY="2.0" prefHeight="25.0" prefWidth="137.0" promptText="Name"> <TextField fx:id="airlNameBox" layoutX="97.0" layoutY="2.0" prefHeight="25.0" prefWidth="137.0" promptText="Name">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="airlAliasBox" layoutX="229.0" layoutY="2.0" prefHeight="25.0" prefWidth="125.0" promptText="Alias"> <TextField fx:id="airlAliasBox" layoutX="234.0" layoutY="2.0" prefHeight="25.0" prefWidth="125.0" promptText="Alias">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="airlIATABox" layoutX="354.0" layoutY="2.0" prefHeight="25.0" prefWidth="67.0" promptText="IATA"> <TextField fx:id="airlIATABox" layoutX="359.0" layoutY="2.0" prefHeight="25.0" prefWidth="67.0" promptText="IATA">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="airlICAOBox" layoutX="421.0" layoutY="2.0" prefHeight="25.0" prefWidth="69.0" promptText="ICAO"> <TextField fx:id="airlICAOBox" layoutX="426.0" layoutY="2.0" prefHeight="25.0" prefWidth="69.0" promptText="ICAO">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="airlCallsignBox" layoutX="490.0" layoutY="2.0" prefHeight="25.0" prefWidth="87.0" promptText="Callsign"> <TextField fx:id="airlCallsignBox" layoutX="495.0" layoutY="2.0" prefHeight="25.0" prefWidth="84.0" promptText="Callsign">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="airlCountryBox" layoutX="577.0" layoutY="2.0" prefHeight="25.0" prefWidth="87.0" promptText="Country"> <TextField fx:id="airlCountryBox" layoutX="579.0" layoutY="2.0" prefHeight="25.0" prefWidth="102.0" promptText="Country">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="airlActiveBox" layoutX="664.0" layoutY="2.0" prefHeight="25.0" prefWidth="93.0" promptText="Active"> <TextField fx:id="airlActiveBox" layoutX="681.0" layoutY="2.0" prefHeight="25.0" prefWidth="84.0" promptText="Active">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
@ -90,9 +90,9 @@
</Pane> </Pane>
</children> </children>
</Pane> </Pane>
<Pane prefHeight="114.0" prefWidth="202.0" GridPane.columnSpan="2" GridPane.rowIndex="1"> <Pane prefHeight="142.0" prefWidth="202.0" GridPane.columnSpan="2" GridPane.rowIndex="1" GridPane.rowSpan="2147483647">
<children> <children>
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#ec1fff35" height="145.0" stroke="BLACK" strokeType="INSIDE" width="800.0" /> <Rectangle arcHeight="5.0" arcWidth="5.0" fill="#ec1fff35" height="142.0" stroke="BLACK" strokeType="INSIDE" width="800.0" />
</children> </children>
</Pane> </Pane>
</children> </children>

@ -31,7 +31,7 @@
<Font size="29.0" /> <Font size="29.0" />
</font> </font>
</Label> </Label>
<ScrollPane hbarPolicy="ALWAYS" layoutX="14.0" layoutY="364.0" prefHeight="47.0" prefViewportHeight="29.0" prefViewportWidth="1095.0" prefWidth="770.0" vbarPolicy="NEVER"> <ScrollPane hbarPolicy="ALWAYS" layoutX="14.0" layoutY="369.0" prefHeight="47.0" prefViewportHeight="29.0" prefViewportWidth="1095.0" prefWidth="772.0" vbarPolicy="NEVER">
<content> <content>
<Pane prefHeight="29.0" prefWidth="1219.0"> <Pane prefHeight="29.0" prefWidth="1219.0">
<children> <children>
@ -95,11 +95,11 @@
</Pane> </Pane>
</content> </content>
</ScrollPane> </ScrollPane>
<Button layoutX="10.0" layoutY="420.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" /> <Button layoutX="15.0" layoutY="420.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
<Button layoutX="661.0" layoutY="420.0" mnemonicParsing="false" onAction="#addAirportSingle" prefHeight="25.0" prefWidth="125.0" text="Add" /> <Button layoutX="662.0" layoutY="420.0" mnemonicParsing="false" onAction="#addAirportSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
<Pane layoutX="15.0" layoutY="60.0" prefHeight="295.0" prefWidth="772.0"> <Pane layoutX="15.0" layoutY="60.0" prefHeight="295.0" prefWidth="772.0">
<children> <children>
<TableView fx:id="tableViewAirportRD" prefHeight="293.0" prefWidth="770.0"> <TableView fx:id="tableViewAirportRD" prefHeight="300.0" prefWidth="772.0">
<columns> <columns>
<TableColumn fx:id="airpIDcol" prefWidth="83.0" text="Airport ID" /> <TableColumn fx:id="airpIDcol" prefWidth="83.0" text="Airport ID" />
<TableColumn fx:id="airpNamecol" prefWidth="137.0" text="Name" /> <TableColumn fx:id="airpNamecol" prefWidth="137.0" text="Name" />
@ -118,7 +118,7 @@
</children></Pane> </children></Pane>
</children> </children>
</Pane> </Pane>
<Pane prefHeight="153.0" prefWidth="800.0" GridPane.columnSpan="2" GridPane.rowIndex="1"> <Pane prefHeight="137.0" prefWidth="800.0" GridPane.columnSpan="2" GridPane.rowIndex="1" GridPane.rowSpan="2147483647">
<children> <children>
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#ec1fff35" height="142.0" layoutY="1.0" stroke="BLACK" strokeType="INSIDE" width="800.0" /> <Rectangle arcHeight="5.0" arcWidth="5.0" fill="#ec1fff35" height="142.0" layoutY="1.0" stroke="BLACK" strokeType="INSIDE" width="800.0" />
</children> </children>

@ -31,51 +31,51 @@
<Font size="29.0" /> <Font size="29.0" />
</font> </font>
</Label> </Label>
<ScrollPane hbarPolicy="ALWAYS" layoutX="10.0" layoutY="364.0" prefHeight="47.0" prefViewportHeight="29.0" prefViewportWidth="1095.0" prefWidth="776.0" vbarPolicy="NEVER"> <ScrollPane hbarPolicy="ALWAYS" layoutX="15.0" layoutY="364.0" prefHeight="47.0" prefViewportHeight="29.0" prefViewportWidth="1095.0" prefWidth="765.0" vbarPolicy="NEVER">
<content> <content>
<Pane prefHeight="49.0" prefWidth="1021.0"> <Pane prefHeight="49.0" prefWidth="1021.0">
<children> <children>
<TextField layoutX="6.0" layoutY="2.0" prefHeight="25.0" prefWidth="60.0" promptText="Airline"> <TextField fx:id="rAirlineBox" layoutX="6.0" layoutY="2.0" prefHeight="25.0" prefWidth="60.0" promptText="Airline">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField layoutX="66.0" layoutY="2.0" prefHeight="25.0" prefWidth="85.0" promptText="Airline ID"> <TextField fx:id="rAirlineIDBox" layoutX="66.0" layoutY="2.0" prefHeight="25.0" prefWidth="85.0" promptText="Airline ID">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField layoutX="151.0" layoutY="2.0" prefHeight="25.0" prefWidth="125.0" promptText="Source airport"> <TextField fx:id="rSourceBox" layoutX="151.0" layoutY="2.0" prefHeight="25.0" prefWidth="125.0" promptText="Source airport">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField layoutX="276.0" layoutY="2.0" prefHeight="25.0" prefWidth="142.0" promptText="Source airport ID"> <TextField fx:id="rSourceIDBox" layoutX="276.0" layoutY="2.0" prefHeight="25.0" prefWidth="142.0" promptText="Source airport ID">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField layoutX="418.0" layoutY="2.0" prefHeight="25.0" prefWidth="154.0" promptText="Destination airport"> <TextField fx:id="rDestBox" layoutX="418.0" layoutY="2.0" prefHeight="25.0" prefWidth="154.0" promptText="Destination airport">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField layoutX="572.0" layoutY="2.0" prefHeight="25.0" prefWidth="187.0" promptText="Destination airport ID"> <TextField fx:id="rDestIDBox" layoutX="572.0" layoutY="2.0" prefHeight="25.0" prefWidth="187.0" promptText="Destination airport ID">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="rCodeshareCol" layoutX="758.0" layoutY="2.0" prefHeight="25.0" prefWidth="99.0" promptText="Codeshare"> <TextField fx:id="rCodeshareBox" layoutX="758.0" layoutY="2.0" prefHeight="25.0" prefWidth="99.0" promptText="Codeshare">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="rStopsCol" layoutX="857.0" layoutY="2.0" prefHeight="25.0" prefWidth="65.0" promptText="Stops"> <TextField fx:id="rStopsBox" layoutX="857.0" layoutY="2.0" prefHeight="25.0" prefWidth="65.0" promptText="Stops">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
</TextField> </TextField>
<TextField fx:id="rEquipmentCol" layoutX="922.0" layoutY="2.0" prefHeight="25.0" prefWidth="98.0" promptText="Equipment"> <TextField fx:id="rEquipmentBox" layoutX="922.0" layoutY="2.0" prefHeight="25.0" prefWidth="98.0" promptText="Equipment">
<padding> <padding>
<Insets left="2.0" right="2.0" /> <Insets left="2.0" right="2.0" />
</padding> </padding>
@ -84,11 +84,11 @@
</Pane> </Pane>
</content> </content>
</ScrollPane> </ScrollPane>
<Button layoutX="10.0" layoutY="420.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" /> <Button layoutX="16.0" layoutY="420.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="125.0" text="Analyse" />
<Button layoutX="661.0" layoutY="420.0" mnemonicParsing="false" onAction="#addRouteSingle" prefHeight="25.0" prefWidth="125.0" text="Add" /> <Button layoutX="655.0" layoutY="420.0" mnemonicParsing="false" onAction="#addRouteSingle" prefHeight="25.0" prefWidth="125.0" text="Add" />
<Pane layoutX="8.0" layoutY="53.0" prefHeight="300.0" prefWidth="776.0"> <Pane layoutX="16.0" layoutY="53.0" prefHeight="300.0" prefWidth="765.0">
<children> <children>
<TableView fx:id="tableViewRouteRD" layoutX="-1.0" prefHeight="300.0" prefWidth="784.0"> <TableView fx:id="tableViewRouteRD" layoutX="-1.0" prefHeight="300.0" prefWidth="765.0">
<columns> <columns>
<TableColumn fx:id="rAirlineCol" prefWidth="67.0" text="Airline" /> <TableColumn fx:id="rAirlineCol" prefWidth="67.0" text="Airline" />
<TableColumn fx:id="rAirlineIDCol" prefWidth="86.0" text="Airline ID" /> <TableColumn fx:id="rAirlineIDCol" prefWidth="86.0" text="Airline ID" />
@ -96,18 +96,18 @@
<TableColumn fx:id="rSourceIDCol" minWidth="0.0" prefWidth="141.0" text="Source airport ID" /> <TableColumn fx:id="rSourceIDCol" minWidth="0.0" prefWidth="141.0" text="Source airport ID" />
<TableColumn fx:id="rDestCol" minWidth="0.0" prefWidth="160.0" text="Destination airport" /> <TableColumn fx:id="rDestCol" minWidth="0.0" prefWidth="160.0" text="Destination airport" />
<TableColumn fx:id="rDestIDCol" minWidth="0.0" prefWidth="184.0" text="Destination airport ID" /> <TableColumn fx:id="rDestIDCol" minWidth="0.0" prefWidth="184.0" text="Destination airport ID" />
<TableColumn minWidth="0.0" prefWidth="95.0" text="Codeshare" /> <TableColumn fx:id="rCodeshareCol" minWidth="0.0" prefWidth="95.0" text="Codeshare" />
<TableColumn minWidth="0.0" prefWidth="69.0" text="Stops" /> <TableColumn fx:id="rStopsCol" minWidth="0.0" prefWidth="69.0" text="Stops" />
<TableColumn prefWidth="98.0" text="Equipment" /> <TableColumn fx:id="rEquipmentCol" prefWidth="98.0" text="Equipment" />
</columns> </columns>
</TableView> </TableView>
</children> </children>
</Pane> </Pane>
</children> </children>
</Pane> </Pane>
<Pane prefHeight="114.0" prefWidth="202.0" GridPane.columnSpan="2" GridPane.rowIndex="1"> <Pane prefHeight="142.0" prefWidth="800.0" GridPane.columnSpan="2" GridPane.rowIndex="1" GridPane.rowSpan="2147483647">
<children> <children>
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#ec1fff35" height="144.0" layoutY="1.0" stroke="BLACK" strokeType="INSIDE" width="800.0" /> <Rectangle arcHeight="5.0" arcWidth="5.0" fill="#ec1fff35" height="142.0" layoutY="1.0" stroke="BLACK" strokeType="INSIDE" width="800.0" />
</children> </children>
</Pane> </Pane>
</children> </children>

@ -90,31 +90,31 @@ public class AirportUnitTest {
heathrow.addArrivalRoutes(route1); heathrow.addArrivalRoutes(route1);
heathrow.addArrivalRoutes(routes); heathrow.addArrivalRoutes(routes);
assertEquals(heathrow.getArrivalRoutes().get(0).arrivesAt(), "LHR1"); assertEquals(heathrow.getArrivalRoutes().get(0).getArrivalAirport(), "LHR1");
assertEquals(heathrow.getArrivalRoutes().get(1).arrivesAt(), "LHR1"); assertEquals(heathrow.getArrivalRoutes().get(1).getArrivalAirport(), "LHR1");
assertEquals(heathrow.getArrivalRoutes().get(2).arrivesAt(), "LHR2"); assertEquals(heathrow.getArrivalRoutes().get(2).getArrivalAirport(), "LHR2");
assertEquals(heathrow.getArrivalRoutes().get(3).arrivesAt(), "LHR3"); assertEquals(heathrow.getArrivalRoutes().get(3).getArrivalAirport(), "LHR3");
//check add departrue routes; //check add departrue routes;
heathrow.addDepartureRoutes(route1); heathrow.addDepartureRoutes(route1);
heathrow.addDepartureRoutes(routes); heathrow.addDepartureRoutes(routes);
assertEquals(heathrow.getDepartureRoutes().get(0).departsFrom(), "SIN1"); assertEquals(heathrow.getDepartureRoutes().get(0).getDepartureAirport(), "SIN1");
assertEquals(heathrow.getDepartureRoutes().get(1).departsFrom(), "SIN1"); assertEquals(heathrow.getDepartureRoutes().get(1).getDepartureAirport(), "SIN1");
assertEquals(heathrow.getDepartureRoutes().get(2).departsFrom(), "SIN2"); assertEquals(heathrow.getDepartureRoutes().get(2).getDepartureAirport(), "SIN2");
assertEquals(heathrow.getDepartureRoutes().get(3).departsFrom(), "SIN3"); assertEquals(heathrow.getDepartureRoutes().get(3).getDepartureAirport(), "SIN3");
//check set //check set
heathrow.setArrivalRoutes(routes); heathrow.setArrivalRoutes(routes);
heathrow.setDepartureRoutes(routes); heathrow.setDepartureRoutes(routes);
//Arrival check //Arrival check
assertEquals(heathrow.getArrivalRoutes().get(0).arrivesAt(), "LHR1"); assertEquals(heathrow.getArrivalRoutes().get(0).getArrivalAirport(), "LHR1");
assertEquals(heathrow.getArrivalRoutes().get(1).arrivesAt(), "LHR2"); assertEquals(heathrow.getArrivalRoutes().get(1).getArrivalAirport(), "LHR2");
assertEquals(heathrow.getArrivalRoutes().get(2).arrivesAt(), "LHR3"); assertEquals(heathrow.getArrivalRoutes().get(2).getArrivalAirport(), "LHR3");
//departure check //departure check
assertEquals(heathrow.getDepartureRoutes().get(0).departsFrom(), "SIN1"); assertEquals(heathrow.getDepartureRoutes().get(0).getDepartureAirport(), "SIN1");
assertEquals(heathrow.getDepartureRoutes().get(1).departsFrom(), "SIN2"); assertEquals(heathrow.getDepartureRoutes().get(1).getDepartureAirport(), "SIN2");
assertEquals(heathrow.getDepartureRoutes().get(2).departsFrom(), "SIN3"); assertEquals(heathrow.getDepartureRoutes().get(2).getDepartureAirport(), "SIN3");
} }
@Test @Test

@ -28,8 +28,8 @@ public class RouteTest extends TestCase {
//test getters //test getters
////////////// //////////////
assertEquals(route.getAirline(), "BA"); assertEquals(route.getAirline(), "BA");
assertEquals(route.departsFrom(), "SIN"); assertEquals(route.getDepartureAirport(), "SIN");
assertEquals(route.arrivesAt(), "LHR"); assertEquals(route.getArrivalAirport(), "LHR");
assertEquals(route.getCode(), ""); assertEquals(route.getCode(), "");
assertEquals(route.getEquipment(), "744 777"); assertEquals(route.getEquipment(), "744 777");
/////////////// ///////////////
@ -43,8 +43,8 @@ public class RouteTest extends TestCase {
route.setEquipment("747 840"); route.setEquipment("747 840");
assertEquals(route.getAirline(), "BAH"); assertEquals(route.getAirline(), "BAH");
assertEquals(route.departsFrom(), "SING-SONG"); assertEquals(route.getDepartureAirport(), "SING-SONG");
assertEquals(route.arrivesAt(), "LEFT-HAND-RULE"); assertEquals(route.getArrivalAirport(), "LEFT-HAND-RULE");
assertEquals(route.getCode(), "Y"); assertEquals(route.getCode(), "Y");
assertEquals(route.getEquipment(), "747 840"); assertEquals(route.getEquipment(), "747 840");
//////////////////////////// ////////////////////////////

Loading…
Cancel
Save