-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMessage.java
More file actions
53 lines (44 loc) · 1.03 KB
/
Message.java
File metadata and controls
53 lines (44 loc) · 1.03 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
package edu.bits.dc;
import java.io.Serializable;
/**
* This class represents a message to be exchanged between processes in distributed computing environment.
*/
public class Message implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Name of the process.
*/
private final String processName;
/**
* Logical clock of process.
*/
private final int logicalClock;
/**
* Constructs an immutable packet with initialized values.
* @param processName
* @param logicalClock
*/
public Message(String processName, int logicalClock) {
this.processName = processName;
this.logicalClock = logicalClock;
}
/**
* This method gets the process name.
* @return
*/
public String getProcessName() {
return processName;
}
/**
* This method gets the logical clock value.
* @return
*/
public int getLogicalClock() {
return logicalClock;
}
@Override
public String toString() {
return String.format("Message [processName=%s, logicalClock=%s]",
processName, logicalClock);
}
}