Class AbstractGenerator<T>

    • Field Detail

      • name

        protected String name
        Symbolic name for the value generator.
      • allocationSize

        protected int allocationSize
        Allocation size
      • initialValue

        protected int initialValue
        Initial value (of the first id).
    • Constructor Detail

      • AbstractGenerator

        public AbstractGenerator​(StoreManager storeMgr,
                                 String name)
        Constructor.
        Parameters:
        storeMgr - Store Manager
        name - Symbolic name for this generator
    • Method Detail

      • getName

        public String getName()
        Accessor for the symbolic name for this generator.
        Returns:
        Symbolic name for the generator.
      • next

        public T next()
        Get next value from the reserved block of values.
        Specified by:
        next in interface ValueGenerator<T>
        Returns:
        The next value
      • current

        public T current()
        Accessor for the current value allocated. Returns null if none are allocated
        Specified by:
        current in interface ValueGenerator<T>
        Returns:
        The current value
      • allocate

        public void allocate​(int additional)
        Method to allocate a number of values into the block. If the block already exists and has remaining values, the additional values are added to the block.
        Specified by:
        allocate in interface ValueGenerator<T>
        Parameters:
        additional - The number to allocate
      • obtainGenerationBlock

        protected ValueGenerationBlock<T> obtainGenerationBlock()
        Get a new block with the default number of ids.
        Returns:
        the block
      • obtainGenerationBlock

        protected ValueGenerationBlock<T> obtainGenerationBlock​(int number)
        Get a new block with the specified number of ids.
        Parameters:
        number - The number of additional ids required
        Returns:
        the block
      • reserveBlock

        protected ValueGenerationBlock<T> reserveBlock()
        Method to reserve a default sized block of values.
        Returns:
        The reserved block
      • reserveBlock

        protected abstract ValueGenerationBlock<T> reserveBlock​(long size)
        Method to reserve a block of "size" values.
        Parameters:
        size - Number of values to reserve
        Returns:
        The allocated block