-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathEvent.java
More file actions
128 lines (113 loc) · 2.8 KB
/
Event.java
File metadata and controls
128 lines (113 loc) · 2.8 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
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
import java.io.Serializable;
import java.util.*;
public abstract class Event implements Serializable{
protected Date date;
protected String firstFiller;
protected String secondFiller;
protected String on=" on ";
protected ArrayList<String> sentence=new ArrayList<String>();
Event(){
//Should be called to set the date
date=Calendar.getInstance().getTime();
/*//Should never be called here
System.out.println("You called the event superclass constructor");
createSentence();*/
}
// Creates the sentence to be stores until retrieved
// priority and comment events use given priorities and comments
// respectively to create these sentences
public abstract ArrayList<String> createSentence();
public abstract int getStringType(int index);
// another way to get the sentence
public ArrayList getSentence() {
return sentence;
}
public Date getDate() {
return date;
}
public void setDate(Date dddate) {
date = dddate;
}
// Returns the type of event it is
// Either the String "Comment" or "Priority"
// Corresponding to the type of event of course
public abstract String getType();
// Will return the new and old comment if
// it contains a commentEvent. If not, then returns null.
// please check what type of event it is using getType
// before calling either of these two methods
public abstract String getOldComment();
public abstract String getNewComment();
public static String convertMonth(int num) {
String month;
if(num == 0) {
month = "January";
}
else if(num ==1) {
month = "February";
}
else if(num ==2) {
month = "March";
}
else if(num ==3) {
month = "April";
}
else if(num ==4) {
month = "May";
}
else if(num ==5) {
month = "June";
}
else if(num ==6) {
month = "July";
}
else if(num ==7) {
month = "August";
}
else if(num ==8) {
month = "September";
}
else if(num ==9) {
month = "October";
}
else if(num ==10) {
month = "November";
}
else{
month = "December";
}
return month;
}
public static String convertDay(int num) {
String day;
if(num == 0) {
day = "Sunday";
}
else if(num ==1) {
day = "Monday";
}
else if(num ==2) {
day = "Tuesday";
}
else if(num ==3) {
day = "Wednesday";
}
else if(num ==4) {
day = "Thursday";
}
else if(num ==5) {
day = "Friday";
}
else{
day = "Saturday";
}
return day;
}
public static String getDateString(Date date) {
String dateString=Event.convertDay(date.getDay())+" "+Event.convertMonth(date.getMonth())
+" "+date.getDate()+", "+(1900+date.getYear());
return dateString;
}
public abstract void setComment(String newcomment);
public abstract void editComment(HistoryPage h);
}