Class AppIdTracker
java.lang.Object
uk.ac.manchester.spinnaker.transceiver.AppIdTracker
public class AppIdTracker extends Object
A tracker of application IDs to make it easier to allocate new IDs.
-
Constructor Summary
Constructors Constructor Description AppIdTracker()
Allocate 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 Type Method Description void
allocateID(AppID id)
Allocate a given ID.AppID
allocateNewID()
Get a new unallocated ID.void
freeID(AppID id)
Free 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
-