Wrote java doc for Airline as well as fixed up constructor order to match the openflights layout. Lastly added a toString function which returns the name of the Airline.
This commit is contained in:
@@ -2,6 +2,11 @@ package seng202.group9.Core;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Airline Class Stores all Airline information.
|
||||||
|
* @author Fan-Wu Yang
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class Airline {
|
public class Airline {
|
||||||
private int ID;
|
private int ID;
|
||||||
private String IATA;
|
private String IATA;
|
||||||
@@ -13,7 +18,19 @@ public class Airline {
|
|||||||
private Country country;
|
private Country country;
|
||||||
private ArrayList<Route> routes;
|
private ArrayList<Route> routes;
|
||||||
|
|
||||||
public Airline(int ID, String IATA, String ICAO, String name, String alias, String callSign, String active, Country country){
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param ID
|
||||||
|
* @param name
|
||||||
|
* @param alias
|
||||||
|
* @param IATA
|
||||||
|
* @param ICAO
|
||||||
|
* @param callSign
|
||||||
|
* @param country
|
||||||
|
* @param active
|
||||||
|
*/
|
||||||
|
public Airline(int ID, String name, String alias, String IATA, String ICAO, String callSign, Country country, String active){
|
||||||
this.ID = ID;
|
this.ID = ID;
|
||||||
this.IATA = IATA;
|
this.IATA = IATA;
|
||||||
this.ICAO = ICAO;
|
this.ICAO = ICAO;
|
||||||
@@ -25,80 +42,147 @@ public class Airline {
|
|||||||
routes = new ArrayList<Route>();
|
routes = new ArrayList<Route>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the ID of the Airline this is correlated to the database.
|
||||||
|
* @param iD
|
||||||
|
*/
|
||||||
public void setID(int iD) {
|
public void setID(int iD) {
|
||||||
ID = iD;
|
ID = iD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes IATA code.
|
||||||
|
* @param iATA
|
||||||
|
*/
|
||||||
|
|
||||||
public void setIATA(String iATA) {
|
public void setIATA(String iATA) {
|
||||||
IATA = iATA;
|
IATA = iATA;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Changes ICAO code
|
||||||
|
* @param iCAO
|
||||||
|
*/
|
||||||
public void setICAO(String iCAO) {
|
public void setICAO(String iCAO) {
|
||||||
ICAO = iCAO;
|
ICAO = iCAO;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Changes name
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* CHanges Alias
|
||||||
|
* @param alias
|
||||||
|
*/
|
||||||
public void setAlias(String alias) {
|
public void setAlias(String alias) {
|
||||||
this.alias = alias;
|
this.alias = alias;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Changes Call Sign
|
||||||
|
* @param callSign
|
||||||
|
*/
|
||||||
public void setCallSign(String callSign) {
|
public void setCallSign(String callSign) {
|
||||||
this.callSign = callSign;
|
this.callSign = callSign;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Changes active state
|
||||||
|
* @param active
|
||||||
|
*/
|
||||||
public void setActive(String active) {
|
public void setActive(String active) {
|
||||||
this.active = active;
|
this.active = active;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Changes Country the Airline belongs to
|
||||||
|
* @param country
|
||||||
|
*/
|
||||||
public void setCountry(Country country) {
|
public void setCountry(Country country) {
|
||||||
this.country = country;
|
this.country = country;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Sets routes to the airline
|
||||||
|
* @param routes
|
||||||
|
*/
|
||||||
public void setRoutes(ArrayList<Route> routes) {
|
public void setRoutes(ArrayList<Route> routes) {
|
||||||
this.routes = routes;
|
this.routes = routes;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* get the ID of relative to the database
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public int getID(){
|
public int getID(){
|
||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* get the IATA code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String getIATA(){
|
public String getIATA(){
|
||||||
return IATA;
|
return IATA;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* get the ICAO code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String getICAO(){
|
public String getICAO(){
|
||||||
return ICAO;
|
return ICAO;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* get the name of the airline
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String getName(){
|
public String getName(){
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* get the Alias of the airline
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String getAlias(){
|
public String getAlias(){
|
||||||
return alias;
|
return alias;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* get the call sign of the airline
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String getCallSign(){
|
public String getCallSign(){
|
||||||
return callSign;
|
return callSign;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* get the state of the airline (Y/N)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String getActive(){
|
public String getActive(){
|
||||||
return active;
|
return active;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* get the country the airline belongs to
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public Country getCountry(){
|
public Country getCountry(){
|
||||||
return country;
|
return country;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* get routes the airline flies
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public ArrayList<Route> getRoutes(){
|
public ArrayList<Route> getRoutes(){
|
||||||
return routes;
|
return routes;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* add route to the airline
|
||||||
|
* @param route
|
||||||
|
*/
|
||||||
public void addRoutes(Route route){
|
public void addRoutes(Route route){
|
||||||
routes.add(route);
|
routes.add(route);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* returns the name of the airline when concatenated to a string.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString(){
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user