Class IntBufferWrapper

java.lang.Object
com.googlecode.javaewah32.IntBufferWrapper
All Implemented Interfaces:
Buffer32

final class IntBufferWrapper extends Object implements Buffer32
java.nio.IntBuffer wrapper. Users should not be concerned by this class.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int
    The actual size in words.
    private IntBuffer
    The buffer
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    IntBufferWrapper(IntBuffer slice, int sizeInWords)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    andLastWord(int mask)
    Replaces the last word position in the buffer with its bitwise-and with the given mask.
    void
    andWord(int position, int mask)
    Replaces the word at the given position in the buffer with its bitwise-and with the given mask.
    void
    Resets the buffer The buffer is not fully cleared and any new set operations should overwrite stale data
    Creates and returns a copy of the buffer
    void
    collapse(int position, int length)
    Removes a given number of words at the given position in the buffer.
    void
    ensureCapacity(int capacity)
    Increases the size of the buffer if necessary
    void
    expand(int position, int length)
    Expands the buffer by adding the given number of words at the given position.
    int
    Returns the last word of the buffer
    int
    getWord(int position)
    Returns the word at a given position
    void
    negateWord(int position)
    Negates the word at the given position in the buffer
    void
    negative_push_back(Buffer32 buffer, int start, int number)
    Same as push_back, but the words are negated.
    void
    orLastWord(int mask)
    Replaces the last word position in the buffer with its bitwise-or with the given mask.
    void
    orWord(int position, int mask)
    Replaces the word at the given position in the buffer with its bitwise-or with the given mask.
    void
    push_back(int word)
    Appends the specified word to the end of the buffer
    void
    push_back(Buffer32 buffer, int start, int number)
    Appends the specified buffer words to the end of the buffer.
    void
    Removes the last word from the buffer
    void
    setLastWord(int word)
    Replaces the last word in the buffer with the specified word.
    void
    setWord(int position, int word)
    Replaces the word at the given position in the buffer with the specified word.
    int
    Returns the actual size in words
    void
    swap(Buffer32 other)
    Swap the content of the buffer with another.
    void
    Reduces the internal buffer to its minimal allowable size.

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • actualSizeInWords

      private int actualSizeInWords
      The actual size in words.
    • buffer

      private IntBuffer buffer
      The buffer
  • Constructor Details

    • IntBufferWrapper

      public IntBufferWrapper(IntBuffer buffer)
    • IntBufferWrapper

      public IntBufferWrapper(IntBuffer slice, int sizeInWords)
  • Method Details

    • sizeInWords

      public int sizeInWords()
      Description copied from interface: Buffer32
      Returns the actual size in words
      Specified by:
      sizeInWords in interface Buffer32
    • ensureCapacity

      public void ensureCapacity(int capacity)
      Description copied from interface: Buffer32
      Increases the size of the buffer if necessary
      Specified by:
      ensureCapacity in interface Buffer32
    • getWord

      public int getWord(int position)
      Description copied from interface: Buffer32
      Returns the word at a given position
      Specified by:
      getWord in interface Buffer32
      Returns:
      the word
    • getLastWord

      public int getLastWord()
      Description copied from interface: Buffer32
      Returns the last word of the buffer
      Specified by:
      getLastWord in interface Buffer32
      Returns:
      the last word
    • clear

      public void clear()
      Description copied from interface: Buffer32
      Resets the buffer The buffer is not fully cleared and any new set operations should overwrite stale data
      Specified by:
      clear in interface Buffer32
    • trim

      public void trim()
      Description copied from interface: Buffer32
      Reduces the internal buffer to its minimal allowable size. This can free memory.
      Specified by:
      trim in interface Buffer32
    • setWord

      public void setWord(int position, int word)
      Description copied from interface: Buffer32
      Replaces the word at the given position in the buffer with the specified word.
      Specified by:
      setWord in interface Buffer32
    • setLastWord

      public void setLastWord(int word)
      Description copied from interface: Buffer32
      Replaces the last word in the buffer with the specified word.
      Specified by:
      setLastWord in interface Buffer32
    • push_back

      public void push_back(int word)
      Description copied from interface: Buffer32
      Appends the specified word to the end of the buffer
      Specified by:
      push_back in interface Buffer32
    • push_back

      public void push_back(Buffer32 buffer, int start, int number)
      Description copied from interface: Buffer32
      Appends the specified buffer words to the end of the buffer.
      Specified by:
      push_back in interface Buffer32
      Parameters:
      buffer - the buffer
      start - the position of the first word to add
      number - the number of words to add
    • negative_push_back

      public void negative_push_back(Buffer32 buffer, int start, int number)
      Description copied from interface: Buffer32
      Same as push_back, but the words are negated.
      Specified by:
      negative_push_back in interface Buffer32
      Parameters:
      buffer - the buffer
      start - the position of the first word to add
      number - the number of words to add
    • removeLastWord

      public void removeLastWord()
      Description copied from interface: Buffer32
      Removes the last word from the buffer
      Specified by:
      removeLastWord in interface Buffer32
    • negateWord

      public void negateWord(int position)
      Description copied from interface: Buffer32
      Negates the word at the given position in the buffer
      Specified by:
      negateWord in interface Buffer32
    • andWord

      public void andWord(int position, int mask)
      Description copied from interface: Buffer32
      Replaces the word at the given position in the buffer with its bitwise-and with the given mask.
      Specified by:
      andWord in interface Buffer32
    • orWord

      public void orWord(int position, int mask)
      Description copied from interface: Buffer32
      Replaces the word at the given position in the buffer with its bitwise-or with the given mask.
      Specified by:
      orWord in interface Buffer32
    • andLastWord

      public void andLastWord(int mask)
      Description copied from interface: Buffer32
      Replaces the last word position in the buffer with its bitwise-and with the given mask.
      Specified by:
      andLastWord in interface Buffer32
    • orLastWord

      public void orLastWord(int mask)
      Description copied from interface: Buffer32
      Replaces the last word position in the buffer with its bitwise-or with the given mask.
      Specified by:
      orLastWord in interface Buffer32
    • expand

      public void expand(int position, int length)
      Description copied from interface: Buffer32
      Expands the buffer by adding the given number of words at the given position. The added words may contain stale data.
      Specified by:
      expand in interface Buffer32
      Parameters:
      position - the position of the buffer where to add words
      length - the number of words to add
    • collapse

      public void collapse(int position, int length)
      Description copied from interface: Buffer32
      Removes a given number of words at the given position in the buffer. The freed words at the end of the buffer are properly cleaned.
      Specified by:
      collapse in interface Buffer32
      Parameters:
      position - the position of the buffer where to add words
      length - the number of words to add
    • clone

      Description copied from interface: Buffer32
      Creates and returns a copy of the buffer
      Specified by:
      clone in interface Buffer32
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • swap

      public void swap(Buffer32 other)
      Description copied from interface: Buffer32
      Swap the content of the buffer with another.
      Specified by:
      swap in interface Buffer32
      Parameters:
      other - buffer to swap with