01: /**
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */package com.tc.util;
04:
05: import java.util.Comparator;
06:
07: public class SequenceID extends AbstractIdentifier {
08:
09: public static final SequenceID NULL_ID = new SequenceID();
10: public static final Comparator COMPARATOR = new Comparator() {
11: public int compare(Object o1, Object o2) {
12: long l1 = ((SequenceID) o1).toLong();
13: long l2 = ((SequenceID) o2).toLong();
14: if (l1 < l2)
15: return -1;
16: else if (l1 > l2)
17: return 1;
18: else
19: return 0;
20: }
21: };
22:
23: public SequenceID(long l) {
24: super (l);
25: }
26:
27: private SequenceID() {
28: return;
29: }
30:
31: public String getIdentifierType() {
32: return "SequenceID";
33: }
34:
35: public SequenceID next() {
36: return new SequenceID(toLong() + 1);
37: }
38:
39: }
|