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
package edu.ncsu.csc.itrust.beans;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import edu.ncsu.csc.itrust.enums.SleepType;
/**
* SleepEntryBean.java Version 1 4/6/2015 Copyright notice: none Contains all
* of the information for an entry into the Sleep Diary.
*
*/
public class SleepEntryBean extends EntryBean {
/**
* Unique Primary key so entries can be edited and deleted
*/
private long entryID;
/**
* The Date this sleep was performed
*/
private String strDate = new SimpleDateFormat("MM/dd/yyyy")
.format(new Date());
/**
* Was the sleep nightly or a nap?
*/
private SleepType sleepType;
/**
* How many hours were spent exercising?
*/
private double hoursSlept;
/**
* The MID of the user this sleep 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 sleep entry
*/
public long getEntryID() {
return entryID;
}
/**
* Sets the id of this entry
*
* @param id
* the unique id of a sleep entry
*/
public void setEntryID(long id) {
entryID = id;
}
/**
* Returns a string representation of when the sleep was performed
*
* @return string representation of the date on which the sleep was
* performed
*/
public String getStrDate() {
return strDate;
}
/**
* Parses the strDate to produce a date in the format MM/dd/yyyy
*
* @return the date on which the sleep was performed
*/
public Date getDate() {
try {
return new SimpleDateFormat("MM/dd/yyyy").parse(strDate);
} catch (ParseException e) {
return null;
}
}
/**
* Sets the date as a string
*
* @param strDate
* when the sleep was performed
*/
public void setStrDate(String strDate) {
this.strDate = strDate;
}
/**
* Which type of sleep was performed?
*
* @return the type of sleep
*/
public SleepType getSleepType() {
return sleepType;
}
/**
* Sets the sleep type
*
* @param sleepType
* what type of sleep was it
*/
public void setSleepType(String sleepType) {
this.sleepType = SleepType.parse(sleepType);
}
/**
* @return the hoursSlept
*/
public double getHoursSlept() {
return hoursSlept;
}
/**
* @param hoursSlept
* the hoursSlept to set
*/
public void setHoursSlept(double hoursSlept) {
this.hoursSlept = hoursSlept;
}
/**
* The patient that performed this sleep
*
* @return patient ID that performed this sleep
*/
public long getPatientID() {
return patientID;
}
/**
* Patient that performed this sleep
*
* @param patientID
* patient id of who performed this sleep
*/
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;
}
}