/** * Increments the element of this big array at specified index. * * @param index a position in this big array. */ public void increment(long index) { array[segment(index)][offset(index)]++; }
/** * Returns the element of this big array at specified index. * * @param index a position in this big array. * @return the element of this big array at the specified position. */ public double get(long index) { return array[segment(index)][offset(index)]; }
/** * Returns the element of this big array at specified index. * * @param index a position in this big array. * @return the element of this big array at the specified position. */ public int get(long index) { return array[segment(index)][offset(index)]; }
/** * Increments the element of this big array at specified index. * * @param index a position in this big array. */ public void increment(long index) { array[segment(index)][offset(index)]++; }
/** * Returns the element of this big array at specified index. * * @param index a position in this big array. * @return the element of this big array at the specified position. */ public long get(long index) { return array[segment(index)][offset(index)]; }
/** * Returns the element of this big array at specified index. * * @param index a position in this big array. * @return the element of this big array at the specified position. */ @SuppressWarnings("unchecked") public T get(long index) { return (T) array[segment(index)][offset(index)]; }
private void grow(long length) { // how many segments are required to get to the length? int requiredSegments = segment(length) + 1; // grow base array if necessary if (array.length < requiredSegments) { array = Arrays.copyOf(array, requiredSegments); } // add new segments while (segments < requiredSegments) { allocateNewSegment(); } }
/** * Increments the element of this big array at specified index. * * @param index a position in this big array. */ public void increment(long index) { array[segment(index)][offset(index)]++; }
/** * Increments the element of this big array at specified index. * * @param index a position in this big array. */ public void increment(long index) { array[segment(index)][offset(index)]++; }
/** * Returns the element of this big array at specified index. * * @param index a position in this big array. * @return the element of this big array at the specified position. */ @SuppressWarnings("unchecked") public T get(long index) { return (T) array[segment(index)][offset(index)]; }
/** * Returns the element of this big array at specified index. * * @param index a position in this big array. * @return the element of this big array at the specified position. */ public short get(long index) { return array[segment(index)][offset(index)]; }
/** * Adds the specified value to the specified element of this big array. * * @param index a position in this big array. * @param value the value */ public void add(long index, double value) { array[segment(index)][offset(index)] += value; }
/** * Sets the element of this big array at specified index. * * @param index a position in this big array. */ public void set(long index, int value) { array[segment(index)][offset(index)] = value; }
/** * Adds the specified value to the specified element of this big array. * * @param index a position in this big array. * @param value the value */ public void add(long index, int value) { array[segment(index)][offset(index)] += value; }
/** * Sets the element of this big array at specified index. * * @param index a position in this big array. */ public void set(long index, short value) { array[segment(index)][offset(index)] = value; }
/** * Sets the element of this big array at specified index. * * @param index a position in this big array. */ public void set(long index, double value) { array[segment(index)][offset(index)] = value; }
/** * Sets the element of this big array at specified index. * * @param index a position in this big array. */ public void set(long index, long value) { array[segment(index)][offset(index)] = value; }
/** * Adds the specified value to the specified element of this big array. * * @param index a position in this big array. * @param value the value */ public void add(long index, long value) { array[segment(index)][offset(index)] += value; }
/** * Sets the element of this big array at specified index. * * @param index a position in this big array. */ public void set(long index, T value) { array[segment(index)][offset(index)] = value; }
private void grow(long length) { // how many segments are required to get to the length? int requiredSegments = segment(length) + 1; // grow base array if necessary if (array.length < requiredSegments) { array = Arrays.copyOf(array, requiredSegments); } // add new segments while (segments < requiredSegments) { allocateNewSegment(); } }