Class RUIntArray


  • public final class RUIntArray
    extends RArray

    A resizeable array of unsigned integers. Data are stored in an array of primitive integers.

    Instances of this class are not thread safe.

    Author:
    Jon Blower
    • Field Detail

      • MAX_VALUE

        public static final long MAX_VALUE
        The maximum value that can be stored in this array
        See Also:
        Constant Field Values
      • MIN_VALUE

        public static final long MIN_VALUE
        The minimum value that can be stored in this array
        See Also:
        Constant Field Values
    • Constructor Detail

      • RUIntArray

        public RUIntArray​(int chunkSize)
        Creates an array in which the initial capacity is set the same as the chunk size.
      • RUIntArray

        public RUIntArray​(int initialCapacity,
                          int chunkSize)
        Creates an array with the given initial capacity and chunk size.
        Parameters:
        initialCapacity - The number of elements in the storage array
        chunkSize - The number of storage elements that will be added each time the storage array grows.
    • Method Detail

      • makeStorage

        protected int[] makeStorage​(int capacity)
        Specified by:
        makeStorage in class RArray
      • getLong

        public long getLong​(int i)
        Returns the ith element of the array.
        Specified by:
        getLong in class RArray
        Parameters:
        i - The index of the element to return.
        Returns:
        the ith element of the array.
        Throws:
        ArrayIndexOutOfBoundsException - if i >= size()
      • getInt

        public int getInt​(int i)
        Description copied from class: RArray
        Returns the ith element of the array as a 4-byte integer, irrespective of the underlying storage type.
        Specified by:
        getInt in class RArray
        Parameters:
        i - The index of the element to return.
        Returns:
        the ith element of the array.
      • setElement

        protected void setElement​(int index,
                                  long value)
        Specified by:
        setElement in class RArray
      • swapElements

        public void swapElements​(int i1,
                                 int i2)
        Specified by:
        swapElements in class RArray
      • getMinValue

        protected long getMinValue()
        Specified by:
        getMinValue in class RArray
      • getMaxValue

        protected long getMaxValue()
        Specified by:
        getMaxValue in class RArray