antsnest.datastructure
Class IDPool

java.lang.Object
  extended by antsnest.datastructure.IDPool
All Implemented Interfaces:
Serializable

public class IDPool
extends Object
implements Serializable

A pool of available node ID's

Author:
Chris Clohosy
See Also:
Serialized Form

Constructor Summary
IDPool()
          Constructs a new pool
 
Method Summary
 long getNextFreeID()
          Gets an available ID from the pool
 long getNextHighestID()
          Gets the next highest ID available
 void returnID(long id)
          Returns a now free ID back to the pool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IDPool

public IDPool()
Constructs a new pool

Method Detail

getNextFreeID

public long getNextFreeID()
Gets an available ID from the pool

Returns:
a long, the free ID

returnID

public void returnID(long id)
Returns a now free ID back to the pool

Parameters:
id - the ID to return

getNextHighestID

public long getNextHighestID()
Gets the next highest ID available

Returns:
a long, the highest ID