Package org.onosproject.core
Class IdBlock
- java.lang.Object
-
- org.onosproject.core.IdBlock
-
public final class IdBlock extends Object
A class representing an ID space.
-
-
Constructor Summary
Constructors Constructor Description IdBlock(long start, long size)
Constructs a new ID block with the specified size and initial value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getNextId()
Returns the next ID in the block.long
getSize()
Returns the block size.String
toString()
-
-
-
Constructor Detail
-
IdBlock
public IdBlock(long start, long size)
Constructs a new ID block with the specified size and initial value.- Parameters:
start
- initial value of the blocksize
- size of the block- Throws:
IllegalArgumentException
- if the size is less than or equal to 0
-
-
Method Detail
-
getSize
public long getSize()
Returns the block size.- Returns:
- block size
-
getNextId
public long getNextId()
Returns the next ID in the block.- Returns:
- next ID
- Throws:
UnavailableIdException
- if there is no available ID in the block.
-
-