diff --git a/airline-data/src/main/scala/com/patson/model/Airport.scala b/airline-data/src/main/scala/com/patson/model/Airport.scala index b3d4d5a56..da100e275 100644 --- a/airline-data/src/main/scala/com/patson/model/Airport.scala +++ b/airline-data/src/main/scala/com/patson/model/Airport.scala @@ -394,15 +394,14 @@ case class Airport(iata : String, icao : String, name : String, latitude : Doubl case _ => 500 //mega airports - not suitable for tiny jets } - import Model.Type._ - val multipler = airplaneModel.airplaneType match { - case LIGHT => 1 - case REGIONAL => 1 - case SMALL => 3 - case MEDIUM => 8 - case LARGE => 12 - case X_LARGE => 15 - case JUMBO => 18 + import Model.IcaoClass._ + val multipler = airplaneModel.airplaneClass match { + case CLASS_A => 1 + case CLASS_B => 1 + case CLASS_C => 3 + case CLASS_D => 8 + case CLASS_E => 12 + case CLASS_F => 18 } //apply discount if it's a base diff --git a/airline-data/src/main/scala/com/patson/model/airplane/Model.scala b/airline-data/src/main/scala/com/patson/model/airplane/Model.scala index 6e140772c..767cf48b2 100644 --- a/airline-data/src/main/scala/com/patson/model/airplane/Model.scala +++ b/airline-data/src/main/scala/com/patson/model/airplane/Model.scala @@ -2,65 +2,78 @@ package com.patson.model.airplane import com.patson.model.IdObject import com.patson.model.Airline +import com.patson.model.airplane.Model.IcaoClass.IcaoClass -case class Model(name : String, capacity : Int, fuelBurn : Int, speed : Int, range : Int, price : Int, lifespan : Int, constructionTime : Int, countryCode : String, imageUrl : String = "", var id : Int = 0) extends IdObject { +case class Model(name : String, capacity : Int, fuelBurn : Int, speed : Int, range : Int, wingspan : Int, price : Int, lifespan : Int, constructionTime : Int, countryCode : String, imageUrl : String = "", var id : Int = 0) extends IdObject { import Model.Type._ val airplaneType : Type = { capacity match { case x if (x <= 15) => LIGHT case x if (x <= 60) => REGIONAL - case x if (x <= 150) => SMALL + case x if (x <= 150) => SMALL case x if (x <= 250) => MEDIUM case x if (x <= 350) => LARGE case x if (x <= 500) => X_LARGE case _ => JUMBO } } + import Model.IcaoClass._ + val airplaneClass : IcaoClass = { + wingspan match { + case x if (x < 15) => CLASS_A + case x if (x <= 24) => CLASS_B + case x if (x <= 36) => CLASS_C + case x if (x <= 52) => CLASS_D + case x if (x <= 65) => CLASS_E + case _ => CLASS_F + } + } val turnaroundTime : Int = { airplaneType match { case LIGHT => 45 case REGIONAL => 70 - case SMALL => 100 + case SMALL => 100 case MEDIUM => 140 case LARGE => 180 case X_LARGE => 200 - case JUMBO => 220 + case JUMBO => 220 } } - + val minAirportSize : Int = { - airplaneType match { - case LIGHT => 1 - case REGIONAL => 1 - case SMALL => 2 - case MEDIUM => 3 - case LARGE => 4 - case X_LARGE => 5 - case JUMBO => 5 + airplaneClass match { + case CLASS_A => 1 + case CLASS_B => 1 + case CLASS_C => 2 + case CLASS_D => 3 + case CLASS_E => 4 + case CLASS_F => 5 } } - + val airplaneTypeLabel : String = { airplaneType match { case LIGHT => "Light" case REGIONAL => "Regional" - case SMALL => "Small" + case SMALL => "Small" case MEDIUM => "Medium" case LARGE => "Large" - case X_LARGE => "Extra large" + case X_LARGE => "Extra Large" case JUMBO => "Jumbo" } } - + //weekly fixed cost - val maintenanceCost : Int = { + val maintenanceCost : Int = { (capacity * 100).toInt //for now } + + } object Model { def fromId(id : Int) = { - val modelWithJustId = Model("", 0, 0, 0, 0, 0, 0, 0, countryCode = "") + val modelWithJustId = Model("", 0, 0, 0, 0, 0, 0, 0, 0, countryCode = "") modelWithJustId.id = id modelWithJustId } @@ -68,48 +81,54 @@ object Model { type Type = Value val LIGHT, REGIONAL, SMALL, MEDIUM, LARGE, X_LARGE, JUMBO = Value } + object IcaoClass extends Enumeration { + type IcaoClass = Value + val CLASS_A, CLASS_B, CLASS_C, CLASS_D, CLASS_E, CLASS_F = Value + } //https://en.wikipedia.org/wiki/List_of_jet_airliners - val models = List(Model("Cessna 421", capacity = 7, fuelBurn = (7 * 1).toInt, speed = 300, range = 1555, price = 550000, lifespan = 35 * 52, constructionTime = 0, countryCode = "US"), - Model("Pilatus PC-12", capacity = 9, fuelBurn = (9 * 1.2).toInt, speed = 528, range = 3417, price = 4000000, lifespan = 35 * 52, constructionTime = 0, countryCode = "CH"), - Model("Cessna Caravan", capacity = 14, fuelBurn = (14 * 1).toInt, speed = 344, range = 2400, price = 2500000, lifespan = 35 * 52, constructionTime = 0, countryCode = "US", imageUrl = "https://www.norebbo.com/2017/06/cessna-208-grand-caravan-blank-illustration-templates/"), - Model("Embraer EMB120 Brasilia", capacity = 30, fuelBurn = (30 * 1.9).toInt, speed = 552, range = 1750, price = 8000000, lifespan = 35 * 52, constructionTime = 0, countryCode = "BR", imageUrl = "https://www.norebbo.com/2015/02/embraer-120-brasilia-blank-illustration-templates/"), - Model("Saab 340", capacity = 34, fuelBurn = (34 * 2).toInt, speed = 467, range = 1732, price = 12000000, lifespan = 35 * 52, constructionTime = 0, countryCode = "SE", imageUrl = "https://www.norebbo.com/2018/12/saab-340b-blank-illustration-templates/"), - Model("Embraer ERJ140", capacity = 44, fuelBurn = (44 * 2.5).toInt, speed = 828, range = 2315, price = 15000000, lifespan = 35 * 52, constructionTime = 0, countryCode = "BR", imageUrl = "https://www.norebbo.com/2018/05/embraer-erj-140-blank-illustration-templates/"), - Model("ATR 42-600", capacity = 48, fuelBurn = (48 * 1.5).toInt, speed = 556, range = 1326, price = 20000000, lifespan = 20 * 52, constructionTime = 0, countryCode = "FR", imageUrl = "https://www.norebbo.com/2018/06/atr-42-blank-illustration-templates/"), - Model("Bombardier CRJ200", capacity = 50, fuelBurn = (50 * 1.6).toInt, speed = 830, range = 3150, price = 30000000, lifespan = 35 * 52, constructionTime = 0, countryCode = "CA", imageUrl = "https://www.norebbo.com/2015/04/bombardier-canadair-regional-jet-200-blank-illustration-templates/"), - Model("Bombardier CRJ700", capacity = 78, fuelBurn = (78 * 3).toInt, speed = 828, range = 3045, price = 42000000, lifespan = 35 * 52, constructionTime = 4, countryCode = "CA", imageUrl = "https://www.norebbo.com/2015/05/bombardier-canadair-regional-jet-700-blank-illustration-templates/"), - Model("ATR 72-600", capacity = 78, fuelBurn = (78 * 2.8).toInt, speed = 556, range = 1528, price = 26000000, lifespan = 20 * 52, constructionTime = 4, countryCode = "FR", imageUrl = "https://www.norebbo.com/2017/04/atr-72-blank-illustration-templates/"), - Model("Antonov An148", capacity = 85, fuelBurn = (85 * 3.8).toInt, speed = 835, range = 3500, price = 30000000, lifespan = 20 * 52, constructionTime = 4, countryCode = "UA"), - Model("Embraer EMB170-200", capacity = 88, fuelBurn = (88 * 3).toInt, speed = 871, range = 2200, price = 50000000, lifespan = 30 * 52, constructionTime = 4, countryCode = "BR", imageUrl = "https://www.norebbo.com/2015/10/embraer-erj-175-templates-with-the-new-style-winglets/"), - Model("Comac ARJ21", capacity = 90, fuelBurn = (90 * 3.5).toInt, speed = 828, range = 2200, price = 45000000, lifespan = 25 * 52, constructionTime = 8, countryCode = "CN"), - Model("Bombardier Q400", capacity = 90, fuelBurn = (90 * 3.5).toInt, speed = 556, range = 2040, price = 35000000, lifespan = 30 * 52, constructionTime = 8, countryCode = "CA", imageUrl = "https://www.norebbo.com/2015/08/bombardier-dhc-8-402-q400-blank-illustration-templates/"), - Model("Embraer EMB190", capacity = 100, fuelBurn = (100 * 3.3).toInt, speed = 823, range = 4537, price = 60000000, lifespan = 30 * 52, constructionTime = 8, countryCode = "BR", imageUrl = "https://www.norebbo.com/2015/06/embraer-190-blank-illustration-templates/"), - Model("Sukhoi Superjet 100", capacity = 108, fuelBurn = (108 * 4.1).toInt, speed = 828, range = 4578, price = 40000000, lifespan = 30 * 52, constructionTime = 8, countryCode = "RU", imageUrl = "https://www.norebbo.com/2016/02/sukhoi-ssj-100-blank-illustration-templates/"), - Model("Fokker 100", capacity = 109, fuelBurn = (109 * 3.6).toInt, speed = 845, range = 3170, price = 55000000, lifespan = 30 * 52, constructionTime = 8, countryCode = "NL", imageUrl = "https://www.norebbo.com/2018/07/fokker-100-f-28-0100-blank-illustration-templates/"), - Model("Airbus A318", capacity = 132, fuelBurn = (132 * 3).toInt, speed = 829, range = 7800, price = 90000000, lifespan = 35 * 52, constructionTime = 8, countryCode = "NL", imageUrl = "https://www.norebbo.com/2018/01/airbus-a318-blank-illustration-templates-with-pratt-whitney-and-cfm56-engines/"), - Model("Bombardier CS100", capacity = 133, fuelBurn = (133 * 3.3).toInt, speed = 828, range = 5741, price = 80000000, lifespan = 35 * 52, constructionTime = 8, countryCode = "CA", imageUrl = "https://www.norebbo.com/2016/02/bombardier-cs100-blank-illustration-templates/"), - Model("Boeing 737-700C", capacity = 140, fuelBurn = (140 * 3.3).toInt, speed = 825, range = 6083, price = 85000000, lifespan = 35 * 52, constructionTime = 12, countryCode = "US", imageUrl = "https://www.norebbo.com/2014/04/boeing-737-700-blank-illustration-templates/"), - Model("Embraer E195-E2", capacity = 146, fuelBurn = (146 * 3.7).toInt, speed = 833, range = 4800, price = 60400000, lifespan = 30 * 52, constructionTime = 12, countryCode = "BR", imageUrl = "https://www.norebbo.com/2019/03/embraer-e195-e2-side-view/"), - Model("Airbus A319", capacity = 156, fuelBurn = (156 * 3.4).toInt, speed = 830, range = 6940, price = 95000000, lifespan = 35 * 52, constructionTime = 12, countryCode = "NL", imageUrl = "https://www.norebbo.com/2014/05/airbus-a319-blank-illustration-templates/"), - Model("McDonnel Douglas MD-90", capacity = 160, fuelBurn = (160 * 3.55).toInt, speed = 811, range = 3787, price = 80000000, lifespan = 30 * 52, constructionTime = 18, countryCode = "US", imageUrl = "https://www.norebbo.com/2018/02/mcdonnell-douglas-md-90-blank-illustration-templates/"), - Model("Tupolev Tu-154", capacity = 180, fuelBurn = (180 * 4.8).toInt, speed = 913, range = 5280, price = 45000000, lifespan = 25 * 52, constructionTime = 24, countryCode = "RU", imageUrl = "https://www.norebbo.com/2019/05/tupolev-tu-154-side-view/"), - Model("Boeing 737-800", capacity = 184, fuelBurn = (184 * 3.8).toInt, speed = 825, range = 5436, price = 100000000, lifespan = 35 * 52, constructionTime = 24, countryCode = "US", imageUrl = "https://www.norebbo.com/2012/11/boeing-737-800-blank-illustration-templates/"), - Model("Airbus A320neo", capacity = 195, fuelBurn = (195 * 4).toInt, speed = 833, range = 6500, price = 110000000, lifespan = 35 * 52, constructionTime = 24, countryCode = "NL", imageUrl = "https://www.norebbo.com/2017/08/airbus-a320-neo-blank-illustration-templates/"), - Model("Boeing 757-200", capacity = 200, fuelBurn = (200 * 4.25).toInt, speed = 854, range = 7250, price = 95000000, lifespan = 35 * 52, constructionTime = 24, countryCode = "US", imageUrl = "https://www.norebbo.com/2015/01/boeing-757-200-blank-illustration-templates/"), - Model("Tupolev Tu-204", capacity = 210, fuelBurn = (210 * 4.5).toInt, speed = 810, range = 4300, price = 50000000, lifespan = 25 * 52, constructionTime = 24, countryCode = "RU"), - Model("Boeing 737 MAX 9", capacity = 230, fuelBurn = (230 * 4.2).toInt, speed = 839, range = 6570, price = 124000000, lifespan = 35 * 52, constructionTime = 36, countryCode = "US", imageUrl = "https://www.norebbo.com/2018/05/boeing-737-9-max-blank-illustration-templates/"), - Model("Airbus A321", capacity = 236, fuelBurn = (236 * 4.3).toInt, speed = 830, range = 5930, price = 120000000, lifespan = 35 * 52, constructionTime = 36, countryCode = "NL", imageUrl = "https://www.norebbo.com/2014/03/airbus-a321-blank-illustration-templates/"), - Model("Boeing 787-8 Dreamliner", capacity = 250, fuelBurn = (250 * 4.5).toInt, speed = 907, range = 13621, price = 125000000, lifespan = 35 * 52, constructionTime = 36, countryCode = "US", imageUrl = "https://www.norebbo.com/2013/02/boeing-787-8-blank-illustration-templates/"), - Model("Airbus A300-600", capacity = 266, fuelBurn = (266 * 4.7).toInt, speed = 833, range = 7500, price = 110000000, lifespan = 35 * 52, constructionTime = 36, countryCode = "NL", imageUrl = "https://www.norebbo.com/2018/11/airbus-a300b4-600r-blank-illustration-templates-with-general-electric-engines/"), - Model("McDonnel Douglas MD-11", capacity = 293, fuelBurn = (293 * 4.9).toInt, speed = 876, range = 12670, price = 105000000, lifespan = 30 * 52, constructionTime = 36, countryCode = "US", imageUrl = "https://www.norebbo.com/2018/05/mcdonnell-douglas-md-11-blank-illustration-templates-with-ge-engines/"), - Model("Ilyushin Il-96-300", capacity = 300, fuelBurn = (300 * 5).toInt, speed = 850, range = 11500, price = 60000000, lifespan = 25 * 52, constructionTime = 36, countryCode = "RU"), - Model("Boeing 767-300ER", capacity = 350, fuelBurn = (350 * 4.5).toInt, speed = 913, range = 11093, price = 181000000, lifespan = 35 * 52, constructionTime = 36, countryCode = "US", imageUrl = "https://www.norebbo.com/2014/07/boeing-767-300-blank-illustration-templates/"), - Model("Airbus A340-500", capacity = 375, fuelBurn = (375 * 4.7).toInt, speed = 871, range = 17000, price = 300000000, lifespan = 35 * 52, constructionTime = 48, countryCode = "NL", imageUrl = "https://www.norebbo.com/2016/08/airbus-a340-500-blank-illustration-templates/"), - Model("Airbus A330-300", capacity = 380, fuelBurn = (380 * 4.7).toInt, speed = 871, range = 11300, price = 220000000, lifespan = 35 * 52, constructionTime = 48, countryCode = "NL", imageUrl = "https://www.norebbo.com/2016/02/airbus-a330-300-blank-illustration-templates-with-all-three-engine-options/"), - Model("Ilyushin 96-400", capacity = 436, fuelBurn = (436 * 6.4).toInt, speed = 870, range = 10000, price = 50000000, lifespan = 30 * 52, constructionTime = 48, countryCode = "RU"), - Model("Airbus A350-900", capacity = 440, fuelBurn = (440 * 5).toInt, speed = 903, range = 15000, price = 280000000, lifespan = 35 * 52, constructionTime = 48, countryCode = "NL", imageUrl = "https://www.norebbo.com/2013/07/airbus-a350-900-blank-illustration-templates/"), - Model("Boeing 777-300", capacity = 550, fuelBurn = (550 * 5.5).toInt, speed = 945, range = 11121, price = 300000000, lifespan = 35 * 52, constructionTime = 48, countryCode = "US", imageUrl = "https://www.norebbo.com/2014/03/boeing-777-300-blank-illustration-templates/"), - Model("Boeing 747-400", capacity = 660, fuelBurn = (660 * 5.7).toInt, speed = 945, range = 13446, price = 350000000, lifespan = 35 * 52, constructionTime = 48, countryCode = "US", imageUrl = "https://www.norebbo.com/2013/09/boeing-747-400-blank-illustration-templates/"), - Model("Airbus A380-800", capacity = 853, fuelBurn = (853 * 6).toInt, speed = 945, range = 15700, price = 450000000, lifespan = 35 * 52, constructionTime = 54, countryCode = "NL", imageUrl = "https://www.norebbo.com/2013/06/airbus-a380-800-blank-illustration-templates/")) + val models = List(Model("Cessna 421", capacity = 7, fuelBurn = (7 * 1).toInt, speed = 300, range = 1555, wingspan = 13, price = 550000, lifespan = 35 * 52, constructionTime = 0, countryCode = "US"), + Model("Pilatus PC-12", capacity = 9, fuelBurn = (9 * 1.2).toInt, speed = 528, range = 3417, wingspan = 16, price = 4000000, lifespan = 35 * 52, constructionTime = 0, countryCode = "CH"), + Model("Cessna Caravan", capacity = 14, fuelBurn = (14 * 1).toInt, speed = 344, range = 2400, wingspan = 16, price = 2500000, lifespan = 35 * 52, constructionTime = 0, countryCode = "US", imageUrl = "https://www.norebbo.com/2017/06/cessna-208-grand-caravan-blank-illustration-templates/"), + Model("Embraer EMB120 Brasilia", capacity = 30, fuelBurn = (30 * 1.9).toInt, speed = 552, range = 1750, wingspan = 20, price = 8000000, lifespan = 35 * 52, constructionTime = 0, countryCode = "BR", imageUrl = "https://www.norebbo.com/2015/02/embraer-120-brasilia-blank-illustration-templates/"), + Model("Saab 340", capacity = 34, fuelBurn = (34 * 2).toInt, speed = 467, range = 1732, wingspan = 22, price = 12000000, lifespan = 35 * 52, constructionTime = 0, countryCode = "SE", imageUrl = "https://www.norebbo.com/2018/12/saab-340b-blank-illustration-templates/"), + Model("Embraer ERJ140", capacity = 44, fuelBurn = (44 * 2.5).toInt, speed = 828, range = 2315, wingspan = 20, price = 15000000, lifespan = 35 * 52, constructionTime = 0, countryCode = "BR", imageUrl = "https://www.norebbo.com/2018/05/embraer-erj-140-blank-illustration-templates/"), + Model("ATR 42-600", capacity = 48, fuelBurn = (48 * 1.5).toInt, speed = 556, range = 1326, wingspan = 25, price = 20000000, lifespan = 20 * 52, constructionTime = 0, countryCode = "FR", imageUrl = "https://www.norebbo.com/2018/06/atr-42-blank-illustration-templates/"), + Model("Bombardier CRJ200", capacity = 50, fuelBurn = (50 * 1.6).toInt, speed = 830, range = 3150, wingspan = 21, price = 30000000, lifespan = 35 * 52, constructionTime = 0, countryCode = "CA", imageUrl = "https://www.norebbo.com/2015/04/bombardier-canadair-regional-jet-200-blank-illustration-templates/"), + Model("Bombardier CRJ700", capacity = 78, fuelBurn = (78 * 3).toInt, speed = 828, range = 3045, wingspan = 23, price = 42000000, lifespan = 35 * 52, constructionTime = 4, countryCode = "CA", imageUrl = "https://www.norebbo.com/2015/05/bombardier-canadair-regional-jet-700-blank-illustration-templates/"), + Model("ATR 72-600", capacity = 78, fuelBurn = (78 * 2.8).toInt, speed = 556, range = 1528, wingspan = 27, price = 26000000, lifespan = 20 * 52, constructionTime = 4, countryCode = "FR", imageUrl = "https://www.norebbo.com/2017/04/atr-72-blank-illustration-templates/"), + Model("Antonov An148", capacity = 85, fuelBurn = (85 * 3.8).toInt, speed = 835, range = 3500, wingspan = 29, price = 30000000, lifespan = 20 * 52, constructionTime = 4, countryCode = "UA"), + Model("Embraer EMB170-200", capacity = 88, fuelBurn = (88 * 3).toInt, speed = 871, range = 2200, wingspan = 29, price = 50000000, lifespan = 30 * 52, constructionTime = 4, countryCode = "BR", imageUrl = "https://www.norebbo.com/2015/10/embraer-erj-175-templates-with-the-new-style-winglets/"), + Model("Comac ARJ21", capacity = 90, fuelBurn = (90 * 3.5).toInt, speed = 828, range = 2200, wingspan = 27, price = 45000000, lifespan = 25 * 52, constructionTime = 8, countryCode = "CN"), + Model("Bombardier Q400", capacity = 90, fuelBurn = (90 * 3.5).toInt, speed = 556, range = 2040, wingspan = 28, price = 35000000, lifespan = 30 * 52, constructionTime = 8, countryCode = "CA", imageUrl = "https://www.norebbo.com/2015/08/bombardier-dhc-8-402-q400-blank-illustration-templates/"), + Model("Embraer EMB190", capacity = 100, fuelBurn = (100 * 3.3).toInt, speed = 823, range = 4537, wingspan = 29, price = 60000000, lifespan = 30 * 52, constructionTime = 8, countryCode = "BR", imageUrl = "https://www.norebbo.com/2015/06/embraer-190-blank-illustration-templates/"), + Model("Sukhoi Superjet 100", capacity = 108, fuelBurn = (108 * 4.1).toInt, speed = 828, range = 4578, wingspan = 28, price = 40000000, lifespan = 30 * 52, constructionTime = 8, countryCode = "RU", imageUrl = "https://www.norebbo.com/2016/02/sukhoi-ssj-100-blank-illustration-templates/"), + Model("Fokker 100", capacity = 109, fuelBurn = (109 * 3.6).toInt, speed = 845, range = 3170, wingspan = 28, price = 55000000, lifespan = 30 * 52, constructionTime = 8, countryCode = "NL", imageUrl = "https://www.norebbo.com/2018/07/fokker-100-f-28-0100-blank-illustration-templates/"), + Model("Airbus A318", capacity = 132, fuelBurn = (132 * 3).toInt, speed = 829, range = 7800, wingspan = 34, price = 90000000, lifespan = 35 * 52, constructionTime = 8, countryCode = "NL", imageUrl = "https://www.norebbo.com/2018/01/airbus-a318-blank-illustration-templates-with-pratt-whitney-and-cfm56-engines/"), + Model("Bombardier CS100", capacity = 133, fuelBurn = (133 * 3.3).toInt, speed = 828, range = 5741, wingspan = 35, price = 80000000, lifespan = 35 * 52, constructionTime = 8, countryCode = "CA", imageUrl = "https://www.norebbo.com/2016/02/bombardier-cs100-blank-illustration-templates/"), + Model("Boeing 737-700C", capacity = 140, fuelBurn = (140 * 3.3).toInt, speed = 825, range = 6083, wingspan = 34, price = 85000000, lifespan = 35 * 52, constructionTime = 12, countryCode = "US", imageUrl = "https://www.norebbo.com/2014/04/boeing-737-700-blank-illustration-templates/"), + Model("Embraer E195-E2", capacity = 146, fuelBurn = (146 * 3.7).toInt, speed = 833, range = 4800, wingspan = 35, price = 60400000, lifespan = 30 * 52, constructionTime = 12, countryCode = "BR", imageUrl = "https://www.norebbo.com/2019/03/embraer-e195-e2-side-view/"), + Model("Airbus A319", capacity = 156, fuelBurn = (156 * 3.4).toInt, speed = 830, range = 6940, wingspan = 34, price = 95000000, lifespan = 35 * 52, constructionTime = 12, countryCode = "NL", imageUrl = "https://www.norebbo.com/2014/05/airbus-a319-blank-illustration-templates/"), + Model("McDonnel Douglas MD-90", capacity = 160, fuelBurn = (160 * 3.55).toInt, speed = 811, range = 3787, wingspan = 33, price = 80000000, lifespan = 30 * 52, constructionTime = 18, countryCode = "US", imageUrl = "https://www.norebbo.com/2018/02/mcdonnell-douglas-md-90-blank-illustration-templates/"), + Model("Tupolev Tu-154", capacity = 180, fuelBurn = (180 * 4.8).toInt, speed = 913, range = 5280, wingspan = 38, price = 45000000, lifespan = 25 * 52, constructionTime = 24, countryCode = "RU", imageUrl = "https://www.norebbo.com/2019/05/tupolev-tu-154-side-view/"), + Model("Boeing 737-800", capacity = 184, fuelBurn = (184 * 3.8).toInt, speed = 825, range = 5436, wingspan = 36, price = 100000000, lifespan = 35 * 52, constructionTime = 24, countryCode = "US", imageUrl = "https://www.norebbo.com/2012/11/boeing-737-800-blank-illustration-templates/"), + Model("Airbus A320neo", capacity = 195, fuelBurn = (195 * 4).toInt, speed = 833, range = 6500, wingspan = 36, price = 110000000, lifespan = 35 * 52, constructionTime = 24, countryCode = "NL", imageUrl = "https://www.norebbo.com/2017/08/airbus-a320-neo-blank-illustration-templates/"), + Model("Boeing 757-200", capacity = 200, fuelBurn = (200 * 4.25).toInt, speed = 854, range = 7250, wingspan = 38, price = 95000000, lifespan = 35 * 52, constructionTime = 24, countryCode = "US", imageUrl = "https://www.norebbo.com/2015/01/boeing-757-200-blank-illustration-templates/"), + Model("Tupolev Tu-204", capacity = 210, fuelBurn = (210 * 4.5).toInt, speed = 810, range = 4300, wingspan = 42, price = 50000000, lifespan = 25 * 52, constructionTime = 24, countryCode = "RU"), + Model("Boeing 737 MAX 9", capacity = 230, fuelBurn = (230 * 4.2).toInt, speed = 839, range = 6570, wingspan = 36, price = 124000000, lifespan = 35 * 52, constructionTime = 36, countryCode = "US", imageUrl = "https://www.norebbo.com/2018/05/boeing-737-9-max-blank-illustration-templates/"), + Model("Airbus A321", capacity = 236, fuelBurn = (236 * 4.3).toInt, speed = 830, range = 5930, wingspan = 34, price = 120000000, lifespan = 35 * 52, constructionTime = 36, countryCode = "NL", imageUrl = "https://www.norebbo.com/2014/03/airbus-a321-blank-illustration-templates/"), + Model("Boeing 787-8 Dreamliner", capacity = 250, fuelBurn = (250 * 4.5).toInt, speed = 907, range = 13621, wingspan = 60, price = 125000000, lifespan = 35 * 52, constructionTime = 36, countryCode = "US", imageUrl = "https://www.norebbo.com/2013/02/boeing-787-8-blank-illustration-templates/"), + Model("Airbus A350-900 ULR", capacity = 250, fuelBurn = (250 * 6).toInt, speed = 903, range = 18000, wingspan = 65, price = 282000000, lifespan = 35 * 52, constructionTime = 48, countryCode = "NL", imageUrl = "https://www.norebbo.com/2013/07/airbus-a350-900-blank-illustration-templates/" ), + Model("Airbus A300-600", capacity = 266, fuelBurn = (266 * 4.7).toInt, speed = 833, range = 7500, wingspan = 45, price = 110000000, lifespan = 35 * 52, constructionTime = 36, countryCode = "NL", imageUrl = "https://www.norebbo.com/2018/11/airbus-a300b4-600r-blank-illustration-templates-with-general-electric-engines/"), + Model("McDonnel Douglas MD-11", capacity = 293, fuelBurn = (293 * 4.9).toInt, speed = 876, range = 12670, wingspan = 52, price = 105000000, lifespan = 30 * 52, constructionTime = 36, countryCode = "US", imageUrl = "https://www.norebbo.com/2018/05/mcdonnell-douglas-md-11-blank-illustration-templates-with-ge-engines/"), + Model("Ilyushin Il-96-300", capacity = 300, fuelBurn = (300 * 5).toInt, speed = 850, range = 11500, wingspan = 60, price = 60000000, lifespan = 25 * 52, constructionTime = 36, countryCode = "RU"), + Model("Boeing 767-300ER", capacity = 350, fuelBurn = (350 * 4.5).toInt, speed = 913, range = 11093, wingspan = 48, price = 181000000, lifespan = 35 * 52, constructionTime = 36, countryCode = "US", imageUrl = "https://www.norebbo.com/2014/07/boeing-767-300-blank-illustration-templates/"), + Model("Airbus A340-500", capacity = 375, fuelBurn = (375 * 4.7).toInt, speed = 871, range = 17000, wingspan = 64, price = 300000000, lifespan = 35 * 52, constructionTime = 48, countryCode = "NL", imageUrl = "https://www.norebbo.com/2016/08/airbus-a340-500-blank-illustration-templates/"), + Model("Airbus A330-300", capacity = 380, fuelBurn = (380 * 4.7).toInt, speed = 871, range = 11300, wingspan = 60, price = 220000000, lifespan = 35 * 52, constructionTime = 48, countryCode = "NL", imageUrl = "https://www.norebbo.com/2016/02/airbus-a330-300-blank-illustration-templates-with-all-three-engine-options/"), + Model("Ilyushin 96-400", capacity = 436, fuelBurn = (436 * 6.4).toInt, speed = 870, range = 10000, wingspan = 60, price = 50000000, lifespan = 30 * 52, constructionTime = 48, countryCode = "RU"), + Model("Airbus A350-900", capacity = 440, fuelBurn = (440 * 5).toInt, speed = 903, range = 15000, wingspan = 65, price = 280000000, lifespan = 35 * 52, constructionTime = 48, countryCode = "NL", imageUrl = "https://www.norebbo.com/2013/07/airbus-a350-900-blank-illustration-templates/"), + Model("Boeing 777-300", capacity = 550, fuelBurn = (550 * 5.5).toInt, speed = 945, range = 11121, wingspan = 61, price = 300000000, lifespan = 35 * 52, constructionTime = 48, countryCode = "US", imageUrl = "https://www.norebbo.com/2014/03/boeing-777-300-blank-illustration-templates/"), + Model("Boeing 747-8I", capacity = 605, fuelBurn = (605 * 5.5).toInt, speed = 945, range = 15000, wingspan = 68, price = 357000000, lifespan = 35 * 52, constructionTime = 48, countryCode = "US", imageUrl = "https://www.norebbo.com/2015/12/boeing-747-8i-blank-illustration-templates/"), + Model("Boeing 747-400", capacity = 660, fuelBurn = (660 * 5.7).toInt, speed = 945, range = 13446, wingspan = 64, price = 350000000, lifespan = 35 * 52, constructionTime = 48, countryCode = "US", imageUrl = "https://www.norebbo.com/2013/09/boeing-747-400-blank-illustration-templates/"), + Model("Airbus A380-800", capacity = 853, fuelBurn = (853 * 6).toInt, speed = 945, range = 15700, wingspan = 80, price = 450000000, lifespan = 35 * 52, constructionTime = 54, countryCode = "NL", imageUrl = "https://www.norebbo.com/2013/06/airbus-a380-800-blank-illustration-templates/")) val modelByName = models.map { model => (model.name, model) }.toMap } diff --git a/airline-data/src/test/scala/com/patson/AirplaneModelSpec.scala b/airline-data/src/test/scala/com/patson/AirplaneModelSpec.scala index f4d85383f..5e56f94bf 100644 --- a/airline-data/src/test/scala/com/patson/AirplaneModelSpec.scala +++ b/airline-data/src/test/scala/com/patson/AirplaneModelSpec.scala @@ -2,6 +2,7 @@ package com.patson import com.patson.model._ import com.patson.model.airplane.Model.Type._ +import com.patson.model.airplane.Model.IcaoClass import com.patson.model.airplane._ import org.scalatest.{Matchers, WordSpecLike} @@ -29,13 +30,13 @@ class AirplaneModelSpec extends WordSpecLike with Matchers { def simulateStandard(airplaneModel : Model, loadFactor : Double) : LinkConsumptionDetails = { val distance = if (airplaneModel.range > 10000) 10000 else airplaneModel.range //cap at 10000, otherwise frequency will be very low val (flightType, airportSize) = airplaneModel.airplaneType match { - case LIGHT => (FlightType.SHORT_HAUL_DOMESTIC, 3) - case REGIONAL => (FlightType.LONG_HAUL_DOMESTIC, 4) - case SMALL => (FlightType.LONG_HAUL_INTERNATIONAL, 5) - case MEDIUM => (FlightType.LONG_HAUL_INTERCONTINENTAL, 7) - case LARGE => (FlightType.ULTRA_LONG_HAUL_INTERCONTINENTAL, 8) + case CLASS_A => (FlightType.SHORT_HAUL_DOMESTIC, 3) + case CLASS_B => (FlightType.LONG_HAUL_DOMESTIC, 4) + case CLASS_C => (FlightType.LONG_HAUL_INTERNATIONAL, 5) + case CLASS_D => (FlightType.LONG_HAUL_INTERCONTINENTAL, 7) + case CLASS_E => (FlightType.ULTRA_LONG_HAUL_INTERCONTINENTAL, 8) case X_LARGE => (FlightType.ULTRA_LONG_HAUL_INTERCONTINENTAL, 8) - case JUMBO => (FlightType.ULTRA_LONG_HAUL_INTERCONTINENTAL, 8) + case CLASS_F => (FlightType.ULTRA_LONG_HAUL_INTERCONTINENTAL, 8) } val duration = Computation.calculateDuration(airplaneModel, distance) val frequency = Computation.calculateMaxFrequency(airplaneModel, distance) diff --git a/airline-data/src/test/scala/com/patson/LinkSimulationSpec.scala b/airline-data/src/test/scala/com/patson/LinkSimulationSpec.scala index c2d0d84c3..039a039cf 100644 --- a/airline-data/src/test/scala/com/patson/LinkSimulationSpec.scala +++ b/airline-data/src/test/scala/com/patson/LinkSimulationSpec.scala @@ -44,10 +44,10 @@ class LinkSimulationSpec(_system: ActorSystem) extends TestKit(_system) with Imp import Model.Type._ //LIGHT, REGIONAL, SMALL, MEDIUM, LARGE, JUMBO -// private val GOOD_PROFIT_MARGIN = Map(LIGHT -> 0.35, REGIONAL -> 0.28, SMALL -> 0.2, MEDIUM -> 0.1, LARGE -> 0.05, JUMBO -> 0.05) -// private val MAX_PROFIT_MARGIN = Map(LIGHT -> 0.7, REGIONAL -> 0.5, SMALL -> 0.4, MEDIUM -> 0.3, LARGE -> 0.2, JUMBO -> 0.2) -// private val GOOD_PROFIT_MARGIN = Map(LIGHT -> 0.6, REGIONAL -> 0.5, SMALL -> 0.3, MEDIUM -> 0.1, LARGE -> -0.15, X_LARGE-> -0.2, JUMBO -> -0.25) -// private val MAX_PROFIT_MARGIN = Map(LIGHT -> 0.8, REGIONAL -> 0.7, SMALL -> 0.5, MEDIUM -> 0.2, LARGE -> 0.15, X_LARGE-> 0.1, JUMBO -> 0.1) + // private val GOOD_PROFIT_MARGIN = Map(LIGHT -> 0.35, REGIONAL -> 0.28, SMALL -> 0.2, MEDIUM -> 0.1, LARGE -> 0.05, JUMBO -> 0.05) + // private val MAX_PROFIT_MARGIN = Map(LIGHT -> 0.7, REGIONAL -> 0.5, SMALL -> 0.4, MEDIUM -> 0.3, LARGE -> 0.2, JUMBO -> 0.2) + // private val GOOD_PROFIT_MARGIN = Map(LIGHT -> 0.6, REGIONAL -> 0.5, SMALL -> 0.3, MEDIUM -> 0.1, LARGE -> -0.15, X_LARGE-> -0.2, JUMBO -> -0.25) + // private val MAX_PROFIT_MARGIN = Map(LIGHT -> 0.8, REGIONAL -> 0.7, SMALL -> 0.5, MEDIUM -> 0.2, LARGE -> 0.15, X_LARGE-> 0.1, JUMBO -> 0.1) private val GOOD_PROFIT_MARGIN = Map(LIGHT -> 0.5, REGIONAL -> 0.4, SMALL -> 0.25, MEDIUM -> 0.2, LARGE -> 0.2, X_LARGE -> 0.15, JUMBO -> 0.1) private val MAX_PROFIT_MARGIN = Map(LIGHT -> 0.7, REGIONAL -> 0.7, SMALL -> 0.6, MEDIUM -> 0.45, LARGE -> 0.45, X_LARGE -> 0.45, JUMBO -> 0.35)