KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > gtx > GlobalTransactionID


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.object.gtx;
5
6 import com.tc.util.AbstractIdentifier;
7
8 import java.util.Comparator JavaDoc;
9
10 public class GlobalTransactionID extends AbstractIdentifier {
11
12   public static final GlobalTransactionID NULL_ID = new GlobalTransactionID();
13   public static final Comparator JavaDoc COMPARATOR = new Comparator JavaDoc() {
14                                                        public int compare(Object JavaDoc o1, Object JavaDoc o2) {
15                                                          long l1 = ((GlobalTransactionID) o1).toLong();
16                                                          long l2 = ((GlobalTransactionID) o2).toLong();
17                                                          if (l1 < l2) return -1;
18                                                          else if (l1 > l2) return 1;
19                                                          else return 0;
20                                                        }
21                                                      };
22
23   public GlobalTransactionID(long id) {
24     super(id);
25   }
26
27   private GlobalTransactionID() {
28     super();
29   }
30
31   public String JavaDoc getIdentifierType() {
32     return "GlobalTransactionID";
33   }
34
35   public boolean lessThan(GlobalTransactionID compare) {
36     return isNull() ? true : toLong() < compare.toLong();
37   }
38
39 }
40
Popular Tags