01: package vqwiki;
02:
03: import java.util.Calendar;
04: import java.util.Date;
05:
06: /**
07: * Represents a single reminder in a VQWiki reminders list.
08: *
09: * @author Robert E Brewer
10: * @version 0.1
11: */
12: public class WikiReminder implements java.io.Serializable {
13:
14: protected String userName = "";
15: protected Date remindDate = new Date();
16:
17: /**
18: *
19: */
20: public WikiReminder() {
21: }
22:
23: /**
24: *
25: */
26: public WikiReminder(String newUserName) {
27: this .userName = newUserName;
28: }
29:
30: /**
31: *
32: */
33: public WikiReminder(String newUserName, Date newRemindDate) {
34: this .userName = newUserName;
35: this .remindDate = newRemindDate;
36: }
37:
38: /**
39: *
40: */
41: public String getUserName() {
42: return this .userName;
43: }
44:
45: /**
46: *
47: */
48: public void setUserName(String newUserName) {
49: this .userName = newUserName;
50: }
51:
52: /**
53: *
54: */
55: public Date getRemindDate() {
56: return this .remindDate;
57: }
58:
59: /**
60: *
61: */
62: public void setRemindDate(Date newRemindDate) {
63: this .remindDate = newRemindDate;
64: }
65:
66: /**
67: *
68: */
69: public boolean remindDateEquals(Date dateToCompare) {
70: Calendar cal1 = Calendar.getInstance();
71: Calendar cal2 = Calendar.getInstance();
72: cal1.setTime(this .remindDate);
73: cal2.setTime(dateToCompare);
74: if (cal1.get(Calendar.DATE) != cal2.get(Calendar.DATE)
75: || cal1.get(Calendar.MONTH) != cal2.get(Calendar.MONTH)
76: || cal1.get(Calendar.YEAR) != cal2.get(Calendar.YEAR)) {
77: return false;
78: }
79: return true;
80: }
81:
82: /**
83: *
84: */
85: public boolean equals(Object o) {
86: if (!(o instanceof WikiReminder))
87: return false;
88: WikiReminder c = (WikiReminder) o;
89: if (!this .userName.equals(c.getUserName()))
90: return false;
91: return remindDateEquals(c.getRemindDate());
92: }
93: }
|