y25.base
Class LayeredGraph.IDCreator

java.lang.Object
  extended byy25.base.LayeredGraph.IDCreator
Enclosing class:
LayeredGraph

protected class LayeredGraph.IDCreator
extends Object

A utility class that creates unique IDs. It does so be keeping track of previously created IDs.


Constructor Summary
LayeredGraph.IDCreator()
          Instantiates a new IDCreator that assigns IDs in the range [1,inf).
LayeredGraph.IDCreator(int startID)
          Instantiates a new IDCreator that assigns IDs in the range [startID,inf).
 
Method Summary
 int createID()
          Returns a new and unique ID.
 void removeID(int id)
          Marks the passed as ready for reuse.
 void setUsed(int id)
          Tells the IDCreator that the passed ID should not be used for creating new IDs, since it is already used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayeredGraph.IDCreator

public LayeredGraph.IDCreator()
Instantiates a new IDCreator that assigns IDs in the range [1,inf).


LayeredGraph.IDCreator

public LayeredGraph.IDCreator(int startID)
Instantiates a new IDCreator that assigns IDs in the range [startID,inf).

Method Detail

createID

public int createID()
Returns a new and unique ID.


removeID

public void removeID(int id)
Marks the passed as ready for reuse.


setUsed

public void setUsed(int id)
Tells the IDCreator that the passed ID should not be used for creating new IDs, since it is already used.

Parameters:
id -