1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.classic.turbo.lru;
15
16 public class T_Entry<K> implements Comparable<T_Entry<?>> {
17
18 K k;
19 long sequenceNumber;
20
21 T_Entry(K k, long sn) {
22 this.k = k;
23 this.sequenceNumber = sn;
24 }
25
26 public int compareTo(T_Entry<?> o) {
27 if (!(o instanceof T_Entry)) {
28 throw new IllegalArgumentException("arguments must be of type " + T_Entry.class);
29 }
30
31 T_Entry<?> other = o;
32 if (sequenceNumber > other.sequenceNumber) {
33 return 1;
34 }
35 if (sequenceNumber == other.sequenceNumber) {
36 return 0;
37 }
38 return -1;
39 }
40
41 @Override
42 public String toString() {
43 return "(" + k + "," + sequenceNumber + ")";
44
45 }
46 }