Class IntBigArray


  • public final class IntBigArray
    extends Object
    • Constructor Summary

      Constructors 
      Constructor Description
      IntBigArray()
      Creates a new big array containing one initial segment
      IntBigArray​(int initialValue)
      Creates a new big array containing one initial segment filled with the specified default value
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(long index, int value)
      Adds the specified value to the specified element of this big array.
      void copyTo​(long sourceIndex, IntBigArray destination, long destinationIndex, long length)
      Copies this array, beginning at the specified sourceIndex, to the specified destinationIndex of the destination array.
      void ensureCapacity​(long length)
      Ensures this big array is at least the specified length.
      void fill​(int value)
      Fills the entire big array with the specified value.
      int get​(long index)
      Returns the element of this big array at specified index.
      int[][] getSegments()  
      void increment​(long index)
      Increments the element of this big array at specified index.
      void set​(long index, int value)
      Sets the element of this big array at specified index.
      long sizeOf()
      Returns the size of this big array in bytes.
      void sort​(int from, int to, IntComparator comparator)  
    • Constructor Detail

      • IntBigArray

        public IntBigArray()
        Creates a new big array containing one initial segment
      • IntBigArray

        public IntBigArray​(int initialValue)
        Creates a new big array containing one initial segment filled with the specified default value
    • Method Detail

      • getSegments

        public int[][] getSegments()
      • sizeOf

        public long sizeOf()
        Returns the size of this big array in bytes.
      • get

        public int get​(long index)
        Returns the element of this big array at specified index.
        Parameters:
        index - a position in this big array.
        Returns:
        the element of this big array at the specified position.
      • set

        public void set​(long index,
                        int value)
        Sets the element of this big array at specified index.
        Parameters:
        index - a position in this big array.
      • increment

        public void increment​(long index)
        Increments the element of this big array at specified index.
        Parameters:
        index - a position in this big array.
      • add

        public void add​(long index,
                        int value)
        Adds the specified value to the specified element of this big array.
        Parameters:
        index - a position in this big array.
        value - the value
      • ensureCapacity

        public void ensureCapacity​(long length)
        Ensures this big array is at least the specified length. If the array is smaller, segments are added until the array is larger then the specified length.
      • fill

        public void fill​(int value)
        Fills the entire big array with the specified value.
      • copyTo

        public void copyTo​(long sourceIndex,
                           IntBigArray destination,
                           long destinationIndex,
                           long length)
        Copies this array, beginning at the specified sourceIndex, to the specified destinationIndex of the destination array. A subsequence of this array's components are copied to the destination array referenced by destination. The number of components copied is equal to the length argument. The components at positions sourceIndex through sourceIndex+length-1 in this array are copied into positions destinationIndex through destinationIndex+length-1, respectively, of the destination array.
      • sort

        public void sort​(int from,
                         int to,
                         IntComparator comparator)