1 23 package com.sun.enterprise.util; 24 25 import java.io.Serializable ; 26 27 34 public class UniqueValueBlock implements Serializable { 35 36 private long start_; 38 39 private long extent_; 41 42 private long current_; 44 45 50 UniqueValueBlock(long start, long extent) { 51 start_ = start; 52 extent_ = extent; 53 current_ = start; 54 } 55 56 public synchronized boolean hasNext() { 57 return (current_ < (start_ + extent_)); 58 } 59 60 public synchronized long next() { 61 if( !hasNext() ) { 62 throw new IllegalStateException (); 63 } 64 long returnValue = current_; 65 current_++; 66 return returnValue; 67 } 68 } 69 | Popular Tags |