1   /**
2    * Logback: the generic, reliable, fast and flexible logging framework.
3    * 
4    * Copyright (C) 2000-2008, QOS.ch
5    * 
6    * This library is free software, you can redistribute it and/or modify it under
7    * the terms of the GNU Lesser General Public License as published by the Free
8    * Software Foundation.
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  }