-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFood.java
More file actions
96 lines (79 loc) · 1.77 KB
/
Food.java
File metadata and controls
96 lines (79 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import java.util.LinkedList;
public class Food {
Integer id;
String name;
String group;
LinkedList<Comp> energie;
LinkedList<Comp> macro;
LinkedList<Comp> vitamins;
LinkedList<Comp> minerals;
Food(String n, String g, LinkedList<Comp> e, LinkedList<Comp> mac, LinkedList<Comp> v, LinkedList<Comp> min){
name = n;
group = g;
energie = e;
macro = mac;
vitamins = v;
minerals = min;
}
public Food() {
id = Parser.iD++;
name = null;
group = null;
energie = new LinkedList<>();
macro = new LinkedList<>();
vitamins = new LinkedList<>();
minerals = new LinkedList<>();
}
public void setName(String name) {
this.name = name;
}
public void setGroup(String group) {
this.group = group;
}
public String getGroup() {
return group;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public LinkedList<Comp> getEnergie() {
return energie;
}
public LinkedList<Comp> getMacro() {
return macro;
}
public LinkedList<Comp> getVitamins() {
return vitamins;
}
public LinkedList<Comp> getMinerals() {
return minerals;
}
public void removeAllEmptySubComps() {
for(int i = 0; i < this.energie.size(); i++){
if(this.energie.get(i).subcomps.size() == 0){
this.energie.get(i).setSubcomps(null);
}
}
for(int i = 0; i < this.macro.size(); i++){
if(this.macro.get(i).subcomps.size() == 0){
this.macro.get(i).setSubcomps(null);
}
}
for(int i = 0; i < this.vitamins.size(); i++){
if(this.vitamins.get(i).subcomps.size() == 0){
this.vitamins.get(i).setSubcomps(null);
}
}
for(int i = 0; i < this.minerals.size(); i++){
if(this.minerals.get(i).subcomps.size() == 0){
this.minerals.get(i).setSubcomps(null);
}
}
}
}