readMenue() List<>ingredients hinzugefügt
This commit is contained in:
parent
6f1b665c4c
commit
eb249cb685
213
src/Data.java
213
src/Data.java
@ -2,6 +2,7 @@ import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.sql.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -56,131 +57,115 @@ public class Data {
|
||||
|
||||
List<String> rows = getRows();
|
||||
ArrayList<Menue> menueList = new ArrayList<>();
|
||||
|
||||
|
||||
for (String row : rows) {
|
||||
|
||||
String[] parts = row.split(";");
|
||||
|
||||
|
||||
String date = parts[0];
|
||||
String dish = parts[1];
|
||||
String sideDish = parts[2];
|
||||
String typ = parts[3];
|
||||
String allergens = parts[4];
|
||||
String ingredient = parts[4];
|
||||
|
||||
List<String> ingredients = new ArrayList<>();
|
||||
|
||||
boolean eggs = false;
|
||||
if (!allergens.isEmpty()) {
|
||||
eggs = true;
|
||||
|
||||
}
|
||||
allergens = parts[5];
|
||||
boolean peanuts = false;
|
||||
if (!allergens.isEmpty()) {
|
||||
peanuts = true;
|
||||
}
|
||||
allergens = parts[6];
|
||||
boolean fish = false;
|
||||
if (!allergens.isEmpty()) {
|
||||
fish = true;
|
||||
}
|
||||
allergens = parts[7];
|
||||
boolean grains = false;
|
||||
if (!allergens.isEmpty()) {
|
||||
grains = true;
|
||||
}
|
||||
allergens = parts[8];
|
||||
boolean crustaceans = false;
|
||||
if (!allergens.isEmpty()) {
|
||||
crustaceans = true;
|
||||
}
|
||||
allergens = parts[9];
|
||||
boolean lupines = false;
|
||||
if (!allergens.isEmpty()) {
|
||||
lupines = true;
|
||||
}
|
||||
allergens = parts[10];
|
||||
boolean milk = false;
|
||||
if (!allergens.isEmpty()) {
|
||||
milk = true;
|
||||
}
|
||||
allergens = parts[11];
|
||||
boolean nuts = false;
|
||||
if (!allergens.isEmpty()) {
|
||||
nuts = true;
|
||||
}
|
||||
allergens = parts[12];
|
||||
boolean sulfurDioxideAndSulfite = false;
|
||||
if (!allergens.isEmpty()) {
|
||||
sulfurDioxideAndSulfite = true;
|
||||
}
|
||||
allergens = parts[13];
|
||||
boolean celeriac = false;
|
||||
if (!allergens.isEmpty()) {
|
||||
celeriac = true;
|
||||
}
|
||||
allergens = parts[14];
|
||||
boolean mustards = false;
|
||||
if (!allergens.isEmpty()) {
|
||||
mustards = true;
|
||||
}
|
||||
allergens = parts[15];
|
||||
boolean sesame = false;
|
||||
if (!allergens.isEmpty()) {
|
||||
sesame = true;
|
||||
}
|
||||
allergens = parts[16];
|
||||
boolean soy = false;
|
||||
if (!allergens.isEmpty()) {
|
||||
soy = true;
|
||||
}
|
||||
allergens = parts[17];
|
||||
boolean molluscs = false;
|
||||
if (!allergens.isEmpty()) {
|
||||
molluscs = true;
|
||||
}
|
||||
String additives = parts[18];
|
||||
boolean antioxidant = false;
|
||||
if (!additives.isEmpty()) {
|
||||
antioxidant = true;
|
||||
}
|
||||
additives = parts[19];
|
||||
boolean artificialColours = false;
|
||||
if (!additives.isEmpty()) {
|
||||
artificialColours = true;
|
||||
}
|
||||
additives = parts[20];
|
||||
boolean flavourEnhancer = false;
|
||||
if (!additives.isEmpty()) {
|
||||
flavourEnhancer = true;
|
||||
}
|
||||
additives = parts[21];
|
||||
boolean preservatives = false;
|
||||
if (!additives.isEmpty()) {
|
||||
preservatives = true;
|
||||
}
|
||||
additives = parts[22];
|
||||
boolean nitrate = false;
|
||||
if (!additives.isEmpty()) {
|
||||
nitrate = true;
|
||||
}
|
||||
additives = parts[23];
|
||||
boolean picklingSalt = false;
|
||||
if (!additives.isEmpty()) {
|
||||
picklingSalt = true;
|
||||
}
|
||||
additives = parts[24];
|
||||
boolean phosphate = false;
|
||||
if (!additives.isEmpty()) {
|
||||
phosphate = true;
|
||||
}
|
||||
additives = parts[25];
|
||||
boolean artificialSweetener = false;
|
||||
if (!additives.isEmpty()) {
|
||||
artificialSweetener = true;
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("a"); //eggs
|
||||
}
|
||||
|
||||
menueList.add(new Menue(date, dish, sideDish, typ, eggs, peanuts, fish, grains,
|
||||
crustaceans, lupines, milk, nuts, sulfurDioxideAndSulfite, celeriac, mustards, sesame,
|
||||
soy, molluscs, antioxidant, artificialColours, flavourEnhancer, preservatives, nitrate,
|
||||
picklingSalt, artificialSweetener, phosphate));
|
||||
ingredient = parts[5];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("d"); //peanuts
|
||||
}
|
||||
ingredient = parts[6];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("m"); //fish
|
||||
}
|
||||
ingredient = parts[7];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("g"); //grains
|
||||
}
|
||||
ingredient = parts[8];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("f"); //crustaceans
|
||||
}
|
||||
ingredient = parts[9];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("n"); //lupines
|
||||
}
|
||||
ingredient = parts[10];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("c"); //milk
|
||||
}
|
||||
ingredient = parts[11];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("k"); //nuts
|
||||
}
|
||||
ingredient = parts[12];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("j"); //sulfurDioxideAndSulfite
|
||||
}
|
||||
ingredient = parts[13];
|
||||
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("l"); //celeriac
|
||||
}
|
||||
ingredient = parts[14];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("h"); //mustards
|
||||
}
|
||||
ingredient = parts[15];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("i"); //sesame
|
||||
}
|
||||
ingredient = parts[16];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("b");//soy
|
||||
}
|
||||
ingredient = parts[17];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("e");//molluscs
|
||||
}
|
||||
ingredient = parts[18];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("4"); //antioxidant
|
||||
}
|
||||
ingredient = parts[19];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("5");
|
||||
}
|
||||
ingredient = parts[20];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("6"); //flavourEnhancer
|
||||
}
|
||||
ingredient = parts[21];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("8"); // preservatives
|
||||
}
|
||||
ingredient = parts[22];
|
||||
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("3"); //nitrate
|
||||
}
|
||||
ingredient = parts[23];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("1");//picklingSalt
|
||||
}
|
||||
ingredient = parts[24];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("7"); //artificialSweetener
|
||||
}
|
||||
ingredient = parts[25];
|
||||
if (!ingredient.isEmpty()) {
|
||||
ingredients.add("2"); //phosphate
|
||||
|
||||
}
|
||||
String end = parts[26]; //endpoint
|
||||
|
||||
menueList.add(new Menue(date, dish, sideDish, typ, ingredients));
|
||||
}
|
||||
return menueList;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user