1 4 package com.tc.util; 5 6 import java.util.Comparator ; 7 8 9 public class SequenceID extends AbstractIdentifier { 10 11 public static final SequenceID NULL_ID = new SequenceID(); 12 public static final Comparator COMPARATOR = new Comparator () { 13 public int compare(Object o1, Object 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 getIdentifierType() { 31 return "SequenceID"; 32 } 33 34 public SequenceID next() { 35 return new SequenceID(toLong() + 1); 36 } 37 38 } 39 | Popular Tags |