Class CircularArray_I8

java.lang.Object
org.ddogleg.struct.CircularArrayBase
org.ddogleg.struct.CircularArray_I8

public class CircularArray_I8 extends CircularArrayBase
A circular array for primitive type long which can grow as needed.
  • Field Details

    • data

      public byte[] data
      Internal array that stores elements
  • Constructor Details

    • CircularArray_I8

      public CircularArray_I8()
    • CircularArray_I8

      public CircularArray_I8(int initialMaxSize)
  • Method Details

    • indexOf

      public int indexOf(int offset, CircularArray_I8.Match condition)
      Searches for the next element starting at index "offset" that the passed in condition is true for. Returns -1 if no match was found
    • popHead

      public int popHead()
      Returns and removes the first element from the queue.
      Returns:
      first element in the queue
    • popTail

      public int popTail()
      Returns and removes the last element from the queue.
      Returns:
      last element in the queue
    • head

      public int head()
      Value of the first element in the queue
    • tail

      public int tail()
      Value of the last element in the queue
    • get

      public int get(int index)
      Returns the element in the queue at index. No bounds check is performed and a garbage value might be returned.
      Parameters:
      index - Which element in the queue you wish to access
      Returns:
      the element's value
    • add

      public void add(int value)
      Adds a new element to the queue. If the queue isn't large enough to store this value then its internal data array will grow
      Parameters:
      value - Value which is to be added
    • addW

      public void addW(int value)
      Adds a new element to the queue, but if the queue is full write over the oldest element.
      Parameters:
      value - Value which is to be added
    • setTo

      public CircularArray_I8 setTo(CircularArray_I8 original)
    • copy

      public CircularArray_I8 copy()
    • resizeQueue

      public void resizeQueue(int maxSize)
      Changes the size of the inner array. Does not save old values.
    • shiftElements

      protected void shiftElements(int src0, int dst0, int length)
      Description copied from class: CircularArrayBase
      Copies the value in the src into dst inside the inner array. Needs to handle wrap around
      Specified by:
      shiftElements in class CircularArrayBase
    • getMaxSize

      public int getMaxSize()
      Description copied from class: CircularArrayBase
      Number of elements in the inner array
      Specified by:
      getMaxSize in class CircularArrayBase
    • innerArray

      public <T> T innerArray()
      Description copied from class: CircularArrayBase
      Reference to the inner array
      Specified by:
      innerArray in class CircularArrayBase