-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProcessEvent.java
59 lines (45 loc) · 1.37 KB
/
ProcessEvent.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
import java.io.Serializable;
import java.util.Comparator;
import java.util.Vector;
public class ProcessEvent implements Serializable, Comparator<ProcessEvent> {
private static final long serialVersionUID = 1001626634L;
private String process_id;
private int pid;
private Vector<Integer> vectorClock;
private String event_id;
public String getProcess_id() {
return process_id;
}
public void setProcess_id(String process_id) {
this.process_id = process_id;
}
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public Vector<Integer> getVectorClock() {
return vectorClock;
}
public void setVectorClock(Vector<Integer> vectorClock) {
this.vectorClock = vectorClock;
}
public String getEvent_id() {
return event_id;
}
public void setEvent_id(String event_id) {
this.event_id = event_id;
}
@Override
public int compare(ProcessEvent event1, ProcessEvent event2) {
for (int i = 0; i < event1.getVectorClock().size(); i++) {
if (event1.getVectorClock().get(i) != (event2.getVectorClock().get(i) + 1)) {
if (event1.getVectorClock().get(i) > event2.getVectorClock().get(i)) {
return 1;
}
}
}
return -1;
}
}