-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPacket.java
More file actions
43 lines (32 loc) · 904 Bytes
/
Copy pathPacket.java
File metadata and controls
43 lines (32 loc) · 904 Bytes
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
import java.io.Serializable;
public class Packet implements Serializable {
private final String message;
private final int processId;
private int numOfLikes;
/**
* Piggyback time from sender process.
*/
private final int time;
public Packet(String message, int processId, int time, int numOfLikes) {
this.message = message;
this.processId = processId;
this.time = time;
this.numOfLikes = numOfLikes;
}
public String getMessage() {
return message;
}
public int getProcessId() {
return processId;
}
public int getTime() {
return time;
}
public int getNumOfLikes() {
return numOfLikes;
}
@Override
public String toString() {
return String.format("Packet [message=%s, receiving processId=%s, piggyback time=%s]", message, processId, time);
}
}