1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.lum.common.client.widgets; |
17 |
|
|
18 |
|
import java.util.Date; |
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
@author |
27 |
|
@version |
28 |
|
|
29 |
|
|
|
|
| 0% |
Uncovered Elements: 97 (97) |
Complexity: 35 |
Complexity Density: 0.51 |
|
30 |
|
public abstract class Calendar |
31 |
|
{ |
32 |
|
public static final int AM = 0; |
33 |
|
public static final int AM_PM = 9; |
34 |
|
public static final int PM = 1; |
35 |
|
|
36 |
|
public static final int JANUARY = 0; |
37 |
|
public static final int FEBRUARY = 1; |
38 |
|
public static final int MARCH = 2; |
39 |
|
public static final int APRIL = 3; |
40 |
|
public static final int MAY = 4; |
41 |
|
public static final int JUNE = 5; |
42 |
|
public static final int JULY = 6; |
43 |
|
public static final int AUGUST = 7; |
44 |
|
public static final int SEPTEMBER = 8; |
45 |
|
public static final int OCTOBER = 9; |
46 |
|
public static final int NOVEMBER = 10; |
47 |
|
public static final int DECEMBER = 11; |
48 |
|
public static final int UNDECIMBER = 12; |
49 |
|
|
50 |
|
public static final int SUNDAY = 1; |
51 |
|
public static final int MONDAY = 2; |
52 |
|
public static final int TUESDAY = 3; |
53 |
|
public static final int WEDNESDAY = 4; |
54 |
|
public static final int THURSDAY = 5; |
55 |
|
public static final int FRIDAY = 6; |
56 |
|
public static final int SATURDAY = 7; |
57 |
|
|
58 |
|
|
59 |
|
public static final int ERA = 0; |
60 |
|
public static final int YEAR = 1; |
61 |
|
public static final int MONTH = 2; |
62 |
|
public static final int WEEK_OF_YEAR = 3; |
63 |
|
public static final int WEEK_OF_MONTH = 4; |
64 |
|
public static final int DATE = 5; |
65 |
|
public static final int DAY_OF_MONTH = DATE; |
66 |
|
public static final int DAY_OF_YEAR = 6; |
67 |
|
public static final int DAY_OF_WEEK = 7; |
68 |
|
public static final int DAY_OF_WEEK_IN_MONTH = 8; |
69 |
|
public static final int HOUR = 10; |
70 |
|
public static final int HOUR_OF_DAY = 11; |
71 |
|
public static final int MINUTE = 12; |
72 |
|
public static final int SECOND = 13; |
73 |
|
public static final int MILLISECOND = 14; |
74 |
|
public static final int ZONE_OFFSET = 15; |
75 |
|
public static final int DST_OFFSET = 16; |
76 |
|
public static final int FIELD_COUNT = 17; |
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
protected Date date = null; |
81 |
|
protected int second = -1; |
82 |
|
protected int minute = -1; |
83 |
|
protected int hour = -1; |
84 |
|
protected int dayOfMonth = -1; |
85 |
|
protected int month = -1; |
86 |
|
protected int year = -1; |
87 |
|
protected int amPm = -1; |
88 |
|
|
89 |
|
protected int firstWeekDayOfWeek = Calendar.SUNDAY; |
90 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
91 |
0
|
protected Calendar() {... |
92 |
0
|
setTime(new Date()); |
93 |
|
} |
94 |
|
|
95 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
96 |
0
|
public void setTime(Date date) {... |
97 |
0
|
this.date = date; |
98 |
0
|
computeFields(); |
99 |
|
} |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
100 |
0
|
public void setTime(Calendar cal) {... |
101 |
0
|
this.date = cal.getTime(); |
102 |
0
|
computeFields(); |
103 |
|
} |
104 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
105 |
0
|
public void setTimeInMillis(long milliSeconds) {... |
106 |
0
|
this.date.setTime(milliSeconds); |
107 |
0
|
computeFields(); |
108 |
|
} |
109 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
110 |
0
|
public void set(int year, int month, int dayOfMonth) {... |
111 |
0
|
this.year = year; |
112 |
0
|
this.month = month; |
113 |
0
|
this.dayOfMonth = dayOfMonth; |
114 |
0
|
computeTime(); |
115 |
|
} |
116 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
117 |
0
|
public void set(int year, int month, int dayOfMonth, int hour) {... |
118 |
0
|
this.year = year; |
119 |
0
|
this.month = month; |
120 |
0
|
this.dayOfMonth = dayOfMonth; |
121 |
0
|
this.hour = hour; |
122 |
0
|
computeTime(); |
123 |
|
} |
124 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
125 |
0
|
public void set(int year, int month, int dayOfMonth, int hour, int minute) {... |
126 |
0
|
this.year = year; |
127 |
0
|
this.month = month; |
128 |
0
|
this.dayOfMonth = dayOfMonth; |
129 |
0
|
this.hour = hour; |
130 |
0
|
this.minute = minute; |
131 |
0
|
computeTime(); |
132 |
|
} |
133 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
134 |
0
|
public void set(int year, int month, int dayOfMonth, int hour, int minute, int second) {... |
135 |
0
|
this.year = year; |
136 |
0
|
this.month = month; |
137 |
0
|
this.dayOfMonth = dayOfMonth; |
138 |
0
|
this.hour = hour; |
139 |
0
|
this.minute = minute; |
140 |
0
|
this.second = second; |
141 |
0
|
computeTime(); |
142 |
|
} |
143 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
144 |
0
|
public void set(int fieldCode, String value) {... |
145 |
0
|
set(fieldCode, Integer.parseInt(value)); |
146 |
|
} |
147 |
|
public abstract void set(int fieldCode, int value); |
148 |
|
|
149 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
150 |
0
|
public void setFirstWeekDayOfWeek(int firstWeekDayOfWeek) {... |
151 |
0
|
this.firstWeekDayOfWeek = firstWeekDayOfWeek; |
152 |
|
} |
153 |
|
|
154 |
|
|
155 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
156 |
0
|
public Date getTime() {... |
157 |
0
|
return this.date; |
158 |
|
} |
159 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
160 |
0
|
public long getTimeInMillis() {... |
161 |
0
|
return this.date.getTime(); |
162 |
|
} |
163 |
|
|
164 |
|
|
165 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 10 |
Complexity Density: 0.48 |
|
166 |
0
|
public int get(int fieldCode) {... |
167 |
0
|
switch (fieldCode) { |
168 |
0
|
case Calendar.SECOND: |
169 |
0
|
return this.second; |
170 |
0
|
case Calendar.MINUTE: |
171 |
0
|
return this.minute; |
172 |
0
|
case Calendar.HOUR: |
173 |
0
|
return this.hour; |
174 |
0
|
case Calendar.HOUR_OF_DAY: |
175 |
0
|
if (this.amPm == Calendar.PM) |
176 |
0
|
return this.hour + 12; |
177 |
0
|
return this.hour; |
178 |
0
|
case Calendar.DATE: |
179 |
0
|
return this.dayOfMonth; |
180 |
0
|
case Calendar.MONTH: |
181 |
0
|
return this.month; |
182 |
0
|
case Calendar.YEAR: |
183 |
0
|
return this.year; |
184 |
0
|
case Calendar.AM_PM: |
185 |
0
|
return this.amPm; |
186 |
0
|
default: |
187 |
0
|
return -1; |
188 |
|
} |
189 |
|
} |
190 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
191 |
0
|
public int getFirstWeekDayOfWeek() {... |
192 |
0
|
return this.firstWeekDayOfWeek; |
193 |
|
} |
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
198 |
0
|
public boolean before(Date when) {... |
199 |
0
|
return this.date.before(when); |
200 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
201 |
0
|
public boolean before(Calendar when) {... |
202 |
0
|
return this.date.before(when.getTime()); |
203 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
204 |
0
|
public boolean after(Date when) {... |
205 |
0
|
return this.date.after(when); |
206 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
207 |
0
|
public boolean after(Calendar when) {... |
208 |
0
|
return this.date.after(when.getTime()); |
209 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
210 |
0
|
public boolean equals(Date obj) {... |
211 |
0
|
return this.date.equals(obj); |
212 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
213 |
0
|
public boolean equals(Calendar obj) {... |
214 |
0
|
return this.date.equals(obj.getTime()); |
215 |
|
} |
216 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
217 |
0
|
public boolean isSet(int fieldCode) {... |
218 |
0
|
return true; |
219 |
|
} |
220 |
|
|
221 |
|
|
222 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
223 |
0
|
public void roll(int fieldCode, boolean up) {... |
224 |
0
|
if (up) |
225 |
0
|
roll(fieldCode, 1); |
226 |
|
else |
227 |
0
|
roll(fieldCode, -1); |
228 |
|
} |
229 |
|
|
230 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
231 |
0
|
protected void complete() {... |
232 |
0
|
computeFields(); |
233 |
|
} |
234 |
|
|
235 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
236 |
0
|
public int hashCode() {... |
237 |
0
|
return this.date.hashCode(); |
238 |
|
} |
239 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
240 |
0
|
public String toString() {... |
241 |
0
|
return this.date.toString(); |
242 |
|
} |
243 |
|
|
244 |
|
|
245 |
|
|
246 |
|
|
247 |
|
protected abstract void computeFields(); |
248 |
|
|
249 |
|
|
250 |
|
protected abstract void computeTime(); |
251 |
|
|
252 |
|
|
253 |
|
|
254 |
|
public abstract int getMinimum(int fieldCode); |
255 |
|
|
256 |
|
public abstract int getActualMinimum(int fieldCode); |
257 |
|
|
258 |
|
public abstract int getGreatestMinimum(int fieldCode); |
259 |
|
|
260 |
|
|
261 |
|
public abstract int getMaximum(int fieldCode); |
262 |
|
|
263 |
|
public abstract int getActualMaximum(int fieldCode); |
264 |
|
|
265 |
|
public abstract int getLeastMaximum(int fieldCode); |
266 |
|
|
267 |
|
|
268 |
|
|
269 |
|
public abstract void add(int fieldCode, int amount); |
270 |
|
|
271 |
|
|
272 |
|
public abstract void roll(int fieldCode, int amount); |
273 |
|
|
274 |
|
|
275 |
|
} |