Newer
Older
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
package edu.ncsu.csc.itrust.beans;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import edu.ncsu.csc.itrust.enums.MealType;
/**
* FoodEntryBean.java
* Version 1
* 2/21/2015
* Copyright notice: none
* Contains all of the information for an entry into the Food Diary.
*/
public class FoodEntryBean extends EntryBean {
/**
* Unique Primary key so entries can be edited and deleted
*/
private long entryID;
/**
* The Date this food was eaten
*/
private String dateEatenStr = new SimpleDateFormat("MM/dd/yyyy")
.format(new Date());
/**
* Which meal this was (Lunch, Dinner, Snack, Breakfast)
*/
private MealType mealType;
/**
* The name of the food.
*/
private String food;
/**
* How many servings
*/
private double servings;
/**
* How many calories per serving
*/
private double calories;
/**
* How many grams of fat
*/
private double fatGrams;
/**
* How many milligrams of sodium
*/
private double milligramsSodium;
/**
* How many grams of carbs
*/
private double carbGrams;
/**
* How many grams of sugar
*/
private double sugarGrams;
/**
* How many grams of fiber
*/
private double fiberGrams;
/**
* How many grams of protein
*/
private double proteinGrams;
/**
* The MID of the user this Food Entry belongs to
*/
private long patientID;
/**
* EntryID of the label belonging to this entry
*/
private long labelID;
/**
* Returns the id of this entry so it can be edited/deleted.
* @return unique id of the food entry
*/
public long getEntryID() {
return entryID;
}
/**
* Sets the id of this entry
* @param id the unique id of a food entry
*/
public void setEntryID(long id) {
entryID = id;
}
/**
* Returns a string representation of when the food was eaten
* @return string representation of the date the food was eaten on
*/
public String getDateEatenStr() {
return dateEatenStr;
}
/**
* Parses the dateEatenStr to produce a date in the format
* MM/dd/yyyy
* @return the date the food was eaten on
*/
public Date getDateEaten() {
try {
return new SimpleDateFormat("MM/dd/yyyy").parse(dateEatenStr);
} catch (ParseException e) {
return null;
}
}
/**
* Sets the dateEaten as a string
* @param dateEaten when the food was eaten
*/
public void setDateEatenStr(String dateEaten) {
this.dateEatenStr = dateEaten;
}
/**
* Which type of meal (Breakfast, Lunch, Snack, Dinner) was eaten
* @return the type of meal
*/
public MealType getMealType() {
return mealType;
}
/**
* Sets the meal type
* @param mealType what type of meal was it
*/
public void setMealType(String mealType) {
this.mealType = MealType.parse(mealType);
}
/**
* What was the name of the food
* @return the name of the food
*/
public String getFood() {
return food;
}
/**
* Set the name of the food
* @param food the name of the food that was eaten
*/
public void setFood(String food) {
this.food = food;
}
/**
* How many servings were eaten
* @return number of servings eaten
*/
public double getServings() {
return servings;
}
/**
* Set the number of servings
* @param servings number of servings eaten
*/
public void setServings(double servings) {
this.servings = servings;
}
/**
* How many calories per serving were eaten
* @return calories per serving
*/
public double getCalories() {
return calories;
}
/**
* How many calories were eaten
* @param calories calories per serving
*/
public void setCalories(double calories) {
this.calories = calories;
}
/**
* The number of grams of fat per serving
* @return grams of fat per serving
*/
public double getFatGrams() {
return fatGrams;
}
/**
* How many grams of fat per serving
* @param fatGrams grams of fat per serving
*/
public void setFatGrams(double fatGrams) {
this.fatGrams = fatGrams;
}
/**
* The number of milligrams of sodium per serving
* @return number of milligrams of sodium per serving
*/
public double getMilligramsSodium() {
return milligramsSodium;
}
/**
* Number of milligrams of sodium per serving
* @param milligramsSodium number milligrams of sodium per serving
*/
public void setMilligramsSodium(double milligramsSodium) {
this.milligramsSodium = milligramsSodium;
}
/**
* Number of grams of carbs per serving
* @return grams of carbs per serving
*/
public double getCarbGrams() {
return carbGrams;
}
/**
* Number of grams of carbs per serving
* @param carbGrams grams of carbs per serving
*/
public void setCarbGrams(double carbGrams) {
this.carbGrams = carbGrams;
}
/**
* Number of grams of sugar per serving
* @return grams of sugar per serving
*/
public double getSugarGrams() {
return sugarGrams;
}
/**
* Number of grams of sugar per serving
* @param sugarGrams grams of sugar per serving
*/
public void setSugarGrams(double sugarGrams) {
this.sugarGrams = sugarGrams;
}
/**
* Number of grams of fiber per serving
* @return grams of fiber per serving
*/
public double getFiberGrams() {
return fiberGrams;
}
/**
* Number of grams of fiber per serving
* @param fiberGrams grams of fiber per serving
*/
public void setFiberGrams(double fiberGrams) {
this.fiberGrams = fiberGrams;
}
/**
* The number of grams of protein per serving
* @return grams of protein per serving
*/
public double getProteinGrams() {
return proteinGrams;
}
/**
* Number of grams of protein per serving
* @param proteinGrams grams of protein per serving
*/
public void setProteinGrams(double proteinGrams) {
this.proteinGrams = proteinGrams;
}
/**
* The patient that ate this meal
* @return patient ID that ate this meal
*/
public long getPatientID() {
return patientID;
}
/**
* Patient that ate this meal
* @param patientID patient id of who ate this meal
*/
public void setPatientID(long patientID) {
this.patientID = patientID;
}
/**
* Label of this meal
* @return label of this meal
*/
public long getLabelID() {
return labelID;
}
/**
* Label of this meal
* @param label of this meal
*/
public void setLabelID(long labelID) {
this.labelID = labelID;
}
}