-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMessage.java
58 lines (45 loc) · 1.02 KB
/
Message.java
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
/*
* Message class represents a Message which has process_ID, Message_Type, count of hops, Direction from which it is coming
* */
public class Message {
private int pId;
private double hopCount;
// Direction can be left, right or undefined
private char direction;
// Specifies the type of the message
public enum Type {
READY, NEXT, IN, OUT, LEADER;
}
private Type type;
public Message(int pId, Type type, double hopCount, char direction) {
this.pId = pId;
this.type = type;
this.hopCount = hopCount;
this.direction = direction;
}
// Getters and Setters
public int getpId() {
return pId;
}
public void setpId(int pId) {
this.pId = pId;
}
public double getHopCount() {
return hopCount;
}
public void setHopCount(double hopCount) {
this.hopCount = hopCount;
}
public char getDirection() {
return direction;
}
public void setDirection(char direction) {
this.direction = direction;
}
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
}