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 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 use
      maxAppID - The largest application ID to use
    • AppIdTracker

      public AppIdTracker(Set<AppID> appIDsInUse)
      Allocate an application ID tracker.
      Parameters:
      appIDsInUse - The IDs that are already in use
    • AppIdTracker

      public AppIdTracker(Set<AppID> appIDsInUse, int minAppID, int maxAppID)
      Allocate an application ID tracker.
      Parameters:
      appIDsInUse - The IDs that are already in use
      minAppID - The smallest application ID to use
      maxAppID - The largest application ID to use
  • Method Details

    • allocateNewID

      public AppID allocateNewID()
      Get a new unallocated ID.
      Returns:
      The new ID, now allocated.
      Throws:
      RuntimeException - if there are no IDs available
    • allocateID

      public void allocateID(AppID id)
      Allocate a given ID.
      Parameters:
      id - The ID to allocate.
      Throws:
      IllegalArgumentException - if the ID is not present
    • freeID

      public void freeID(AppID id)
      Free a given ID.
      Parameters:
      id - The ID to free
      Throws:
      IllegalArgumentException - if the ID is out of range