Class BigDogArray<T>

java.lang.Object
org.ddogleg.struct.BigDogArrayBase<T[]>
org.ddogleg.struct.BigDogArray<T>

public class BigDogArray<T> extends BigDogArrayBase<T[]>
Implementation of BigDogArrayBase for any Object[].
  • Constructor Details

  • Method Details

    • arrayLength

      protected int arrayLength(T[] ts)
      Specified by:
      arrayLength in class BigDogArrayBase<T[]>
    • reserve

      public void reserve(int desiredSize)
      Modify reserve so that it doesn't discard the already allocated objects
      Overrides:
      reserve in class BigDogArrayBase<T[]>
    • grow

      public T grow()
      Adds a new element to the tail and returns it.
    • removeSwap

      public void removeSwap(int index)
      Removes an element in O(1) time by swapping the specified index with the last index and resizing to size -1.
      Specified by:
      removeSwap in class BigDogArrayBase<T[]>
    • resize

      public void resize(int desiredSize)
      Override resize so that it calls the reset function
      Overrides:
      resize in class BigDogArrayBase<T[]>
      Parameters:
      desiredSize - (Input) New array size
    • resize

      public void resize(int desiredSize, DProcess<T> configure)
      Resizes the array and fills all new elements with the specified value
      Parameters:
      desiredSize - New array size
      configure - Operator that the "new" element is passed in to.
    • fill

      public void fill(int idx0, int idx1, DProcess<T> configure)
      Fills the elements in the specified range with the specified value.
      Parameters:
      idx0 - (Input) First index, inclusive.
      idx1 - (Input) last index, exclusive.
      configure - Operator that the "new" element is passed in to.
    • get

      public T get(int index)
      Returns the value in the array at the specified index
      Parameters:
      index - (Input) Index in the array
      Returns:
      value at index
    • getTail

      public T getTail(int index)
      Returns the value in the array at the specified index, counting from the end of the array.
      Parameters:
      index - (Input) Index relative to the end counting in reverse order. 0 = get(size-1)
    • forEach

      public void forEach(int idx0, int idx1, DProcess<T> op)
      Simulates a for-each loop. Passes in element values to 'op' from the specified range.
      Parameters:
      idx0 - (Input) First index, inclusive.
      idx1 - (Input) Last index, exclusive.
      op - The operator which processes the values
    • forIdx

      public void forIdx(int idx0, int idx1, DProcessIdx<T> op)
      Simulates a for-each loop. Passes in array indexes and element values to 'op' from the specified range.
      Parameters:
      idx0 - (Input) First index, inclusive.
      idx1 - (Input) Last index, exclusive.
      op - The operator which processes the values