org.apache.poi.util
Class IdentifierManager

java.lang.Object
  extended by org.apache.poi.util.IdentifierManager

public class IdentifierManager
extends java.lang.Object

24.08.2009

Author:
Stefan Stern

Field Summary
static long MAX_ID
           
static long MIN_ID
           
 
Constructor Summary
IdentifierManager(long lowerbound, long upperbound)
           
 
Method Summary
 long getRemainingIdentifiers()
           
 boolean release(long id)
           
 long reserve(long id)
           
 long reserveNew()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_ID

public static final long MAX_ID
See Also:
Constant Field Values

MIN_ID

public static final long MIN_ID
See Also:
Constant Field Values
Constructor Detail

IdentifierManager

public IdentifierManager(long lowerbound,
                         long upperbound)
Parameters:
lowerbound - the lower limit of the id-range to manage. Must be greater than or equal to MIN_ID.
upperbound - the upper limit of the id-range to manage. Must be less then or equal MAX_ID.
Method Detail

reserve

public long reserve(long id)

reserveNew

public long reserveNew()
Returns:
a new identifier.
Throws:
java.lang.IllegalStateException - if no more identifiers are available, then an Exception is raised.

release

public boolean release(long id)
Parameters:
id - the identifier to release. Must be greater than or equal to lowerbound and must be less than or equal to upperbound
Returns:
true, if the identifier was reserved and has been successfully released, false, if the identifier was not reserved.

getRemainingIdentifiers

public long getRemainingIdentifiers()


Copyright 2012 The Apache Software Foundation or its licensors, as applicable.