KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > util > SequenceID


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.util;
5
6 import java.util.Comparator JavaDoc;
7
8
9 public class SequenceID extends AbstractIdentifier {
10
11   public static final SequenceID NULL_ID = new SequenceID();
12   public static final Comparator JavaDoc COMPARATOR = new Comparator JavaDoc() {
13                                                        public int compare(Object JavaDoc o1, Object JavaDoc o2) {
14                                                          long l1 = ((SequenceID) o1).toLong();
15                                                          long l2 = ((SequenceID) o2).toLong();
16                                                          if (l1 < l2) return -1;
17                                                          else if (l1 > l2) return 1;
18                                                          else return 0;
19                                                        }
20                                                      };
21
22   public SequenceID(long l) {
23     super(l);
24   }
25
26   private SequenceID() {
27     return;
28   }
29
30   public String JavaDoc getIdentifierType() {
31     return "SequenceID";
32   }
33   
34   public SequenceID next() {
35     return new SequenceID(toLong() + 1);
36   }
37
38 }
39
Popular Tags