Class IntIndexManager

  • All Implemented Interfaces:
    java.io.Serializable

    public class IntIndexManager
    extends java.lang.Object
    implements java.io.Serializable
    Class to generate int indexes to be used for arrays or tables. If a location or entry in a table becomes available, the index for that location is released. This class manages the use and reuse of those indexes.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      IntIndexManager()
      Constructs an IntIndexManager.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int allocate()
      Returns the smallest unused index value.
      void clear()
      frees all index values.
      void deallocate​(int index)
      Returns the index value so that it can be reused.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IntIndexManager

        public IntIndexManager()
        Constructs an IntIndexManager.
    • Method Detail

      • allocate

        public int allocate()
        Returns the smallest unused index value.
        Throws:
        java.lang.IndexOutOfBoundsException - thrown if there are no unused indexes.
      • deallocate

        public void deallocate​(int index)
        Returns the index value so that it can be reused.
        Parameters:
        index - the index to be free'd for reuse.
      • clear

        public void clear()
        frees all index values.