1 2 5 14 package org.jacorb.trading.db.pse.types; 15 16 import org.omg.CosTradingRepos.ServiceTypeRepositoryPackage.*; 17 18 19 public class Incarnation 20 { 21 private long m_high; 22 private long m_low; 23 private static final long MAX_VALUE = 4294967295L; 24 25 26 private Incarnation(long high, long low) { 28 m_high = high; 29 m_low = low; 30 } 31 32 33 public Incarnation() 34 { 35 m_high = 0; 36 m_low = 1; 37 } 38 39 40 public Incarnation(IncarnationNumber inc) 41 { 42 m_high = inc.high; 43 m_low = inc.low; 44 } 45 46 47 public IncarnationNumber getIncarnationNumber() 48 { 49 return new IncarnationNumber((int)m_high, (int)m_low); 50 } 51 52 53 public int compareTo(Incarnation inc) 54 { 55 int result; 56 57 if ((m_high < inc.m_high) || (m_high == inc.m_high && m_low < inc.m_low)) 58 result = -1; 59 else if (m_high == inc.m_high && m_low == inc.m_low) 60 result = 0; 61 else 62 result = 1; 63 64 return result; 65 } 66 67 68 public void increment() 69 { 70 if (m_low < MAX_VALUE) 71 m_low++; 72 else { 73 m_low = 0; 74 m_high++; 75 } 76 } 77 78 79 public String toString() 80 { 81 return "{" + m_high + "," + m_low + "}"; 82 } 83 84 85 113 } 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | Popular Tags |