ubiware.util
Class Counter

java.lang.Object
  extended by ubiware.util.Counter
Direct Known Subclasses:
UniqueInstanceGenerator

public class Counter
extends java.lang.Object

A synchronised counter, generating a new long on every request.

Author:
Michael Cochez for Ubiware project

Constructor Summary
Counter()
           
 
Method Summary
protected  long getNextNumber()
          generates a new unique nr.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Counter

public Counter()
Method Detail

getNextNumber

protected final long getNextNumber()
generates a new unique nr. The reason this method is protected is to ensure that no one, using the derived generator uses this method straight, since this would endanger the guarantees of the generators.

Returns:
the next number in the sequence