-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcommentEvent.java
More file actions
87 lines (76 loc) · 2.14 KB
/
commentEvent.java
File metadata and controls
87 lines (76 loc) · 2.14 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
import java.util.ArrayList;
public class commentEvent extends Event{
//i added differentiation between adding, removing, and changing a comment
private String oldComment = null;
private String newComment = null;
commentEvent(String oldcomment, String newcomment){
//makes an event when a comment is changed
oldComment= oldcomment;
newComment = newcomment;
int x = 0;
sentence=createSentence(x);
}
commentEvent(String newcomment){
newComment = newcomment;
sentence = createSentence();
}
commentEvent(String newcomment, int identifier){
//makes an event when a comment is added or removed
newComment = newcomment;
sentence=createSentence(identifier);
}
@Override
public ArrayList<String> createSentence() {
// TODO Auto-generated method stub
//makes the string for a change event
firstFiller= "The commment was changed to ";
sentence.add(firstFiller);
sentence.add(newComment);
sentence.add(on);
sentence.add(Event.getDateString(date));
return sentence;
}
public ArrayList<String> createSentence(int identifier) {
// TODO Auto-generated method stub
//makes the string for a remove event
firstFiller= "The commment ";
secondFiller= " was deleted"+on;
sentence.add(firstFiller);
sentence.add(oldComment);
sentence.add(secondFiller);
sentence.add(Event.getDateString(date));
return sentence;
}
public int getStringType(int index) {
String temp=sentence.get(index);
if(temp.equals(oldComment)) {
return 1;
}else if(temp.equals(newComment)) {
return 1;
}
return 0;
}
@Override
public String getType() {
// TODO Auto-generated method stub
return "Comment";
}
@Override
public String getOldComment() {
// TODO Auto-generated method stub
return oldComment;
}
@Override
public String getNewComment() {
// TODO Auto-generated method stub
return newComment;
}
public void editComment(HistoryPage h) {
//creates the comment page when a comment is double clicked
EditAction.makeCommentPage();
}
public void setComment(String newcomment) {
newComment = newcomment;
createSentence();
}
}