Repository navigation
Expand file tree
/
Copy pathMsg.java
More file actions
120 lines (97 loc) · 2.82 KB
/
Copy pathMsg.java
File metadata and controls
120 lines (97 loc) · 2.82 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
import java.time.LocalDateTime;
import java.util.Comparator;
public class Msg implements Comparator<Msg> {
//public class Msg implements Comparable<Msg>
private int msg_id;
private String sender;
private int no_of_cont;
private Contacts receiver;
private String content;
private String seen;
private boolean status;
LocalDateTime timestamp;
public Msg(String sender){
this.sender=sender;
}
public Msg(){
}
public Msg(int msg_id,String sender,Contacts receiver, String content, boolean status, String seen) {
this.msg_id=msg_id;
//sender = "Javairia";
this.sender=sender;
this.receiver=receiver;
this.content = content;
this.status = status;
this.seen=seen;
timestamp = LocalDateTime.now();
}
public void setSender(String sender) {
this.sender = sender;
}
public String getSender() {
return sender;
}
public int getMsg_id() {
return msg_id;
}
public void setMsg_id(int msg_id) {
this.msg_id = msg_id;
}
public int getNo_of_cont() {
return no_of_cont;
}
public void setNo_of_cont(int no_of_cont) {
this.no_of_cont = no_of_cont;
}
public Contacts getReceiver() {
return receiver;
}
public void setReceiver(Contacts receiver) {
this.receiver = receiver;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public boolean getStatus() {
return status;
}
public void isStatus(boolean status) {
this.status = status;
}
public String getSeen() {
return seen;
}
public void setSeen(String seen) {
this.seen = seen;
}
public LocalDateTime getTimestamp() {
return timestamp;
}
public void setTimestamp(LocalDateTime timestamp) {
this.timestamp = timestamp;
}
/*@Override
public int compareTo(Msg other) {
//MessagingApp msgApp=(MessagingApp) o;
return other.getTimestamp().compareTo(this.getTimestamp());
}*/
@Override
public int compare(Msg m1,Msg m2){
return m2.getTimestamp().compareTo(m1.getTimestamp());
}
@Override
public String toString() {
return "Msg{" +
"msg_id=" + msg_id +
", sender='" + sender + '\'' +
", receiver=" + receiver.getName() +
", content='" + content + '\'' +
", status=" + status +
", seen='" + seen + '\'' +
", timestamp=" + timestamp +
'}';
}
}