Class AppIdTracker
java.lang.Object
uk.ac.manchester.spinnaker.transceiver.AppIdTracker
A tracker of application IDs to make it easier to allocate new IDs.
-
Constructor Summary
ConstructorsConstructorDescriptionAllocate an application ID tracker.AppIdTracker(int minAppID, int maxAppID) Allocate an application ID tracker.AppIdTracker(Set<AppID> appIDsInUse) Allocate an application ID tracker.AppIdTracker(Set<AppID> appIDsInUse, int minAppID, int maxAppID) Allocate an application ID tracker. -
Method Summary
Modifier and TypeMethodDescriptionvoidallocateID(AppID id) Allocate a given ID.Get a new unallocated ID.voidFree a given ID.
-
Constructor Details
-
AppIdTracker
public AppIdTracker()Allocate an application ID tracker. -
AppIdTracker
public AppIdTracker(int minAppID, int maxAppID) Allocate an application ID tracker.- Parameters:
minAppID- The smallest application ID to usemaxAppID- The largest application ID to use
-
AppIdTracker
Allocate an application ID tracker.- Parameters:
appIDsInUse- The IDs that are already in use
-
AppIdTracker
Allocate an application ID tracker.- Parameters:
appIDsInUse- The IDs that are already in useminAppID- The smallest application ID to usemaxAppID- The largest application ID to use
-
-
Method Details
-
allocateNewID
Get a new unallocated ID.- Returns:
- The new ID, now allocated.
- Throws:
RuntimeException- if there are no IDs available
-
allocateID
Allocate a given ID.- Parameters:
id- The ID to allocate.- Throws:
IllegalArgumentException- if the ID is not present
-
freeID
Free a given ID.- Parameters:
id- The ID to free- Throws:
IllegalArgumentException- if the ID is out of range
-