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