Interface Buffer

  • All Known Implementing Classes:
    LongArray, LongBufferWrapper

    interface Buffer
    Buffer interface. Users should not be concerned by this class.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void andLastWord​(long mask)
      Replaces the last word position in the buffer with its bitwise-and with the given mask.
      void andWord​(int position, long mask)
      Replaces the word at the given position in the buffer with its bitwise-and with the given mask.
      void clear()
      Resets the buffer The buffer is not fully cleared and any new set operations should overwrite stale data
      Buffer clone()
      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.
      long getLastWord()
      Returns the last word of the buffer
      long 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​(Buffer buffer, int start, int number)
      Same as push_back, but the words are negated.
      void orLastWord​(long mask)
      Replaces the last word position in the buffer with its bitwise-or with the given mask.
      void orWord​(int position, long mask)
      Replaces the word at the given position in the buffer with its bitwise-or with the given mask.
      void push_back​(long word)
      Appends the specified word to the end of the buffer
      void push_back​(Buffer buffer, int start, int number)
      Appends the specified buffer words to the end of the buffer.
      void removeLastWord()
      Removes the last word from the buffer
      void setLastWord​(long word)
      Replaces the last word in the buffer with the specified word.
      void setWord​(int position, long word)
      Replaces the word at the given position in the buffer with the specified word.
      int sizeInWords()
      Returns the actual size in words
      void swap​(Buffer other)
      Swap the content of the buffer with another.
      void trim()
      Reduces the internal buffer to its minimal allowable size.
    • Method Detail

      • sizeInWords

        int sizeInWords()
        Returns the actual size in words
      • ensureCapacity

        void ensureCapacity​(int capacity)
        Increases the size of the buffer if necessary
      • getWord

        long getWord​(int position)
        Returns the word at a given position
        Parameters:
        position -
        Returns:
        the word
      • getLastWord

        long getLastWord()
        Returns the last word of the buffer
        Returns:
        the last word
      • clear

        void clear()
        Resets the buffer The buffer is not fully cleared and any new set operations should overwrite stale data
      • trim

        void trim()
        Reduces the internal buffer to its minimal allowable size. This can free memory.
      • setWord

        void setWord​(int position,
                     long word)
        Replaces the word at the given position in the buffer with the specified word.
        Parameters:
        position -
        word -
      • setLastWord

        void setLastWord​(long word)
        Replaces the last word in the buffer with the specified word.
        Parameters:
        word -
      • push_back

        void push_back​(long word)
        Appends the specified word to the end of the buffer
        Parameters:
        word -
      • push_back

        void push_back​(Buffer buffer,
                       int start,
                       int number)
        Appends the specified buffer words to the end of the buffer.
        Parameters:
        buffer - the buffer
        start - the position of the first word to add
        number - the number of words to add
      • negative_push_back

        void negative_push_back​(Buffer buffer,
                                int start,
                                int number)
        Same as push_back, but the words are negated.
        Parameters:
        buffer - the buffer
        start - the position of the first word to add
        number - the number of words to add
      • removeLastWord

        void removeLastWord()
        Removes the last word from the buffer
      • negateWord

        void negateWord​(int position)
        Negates the word at the given position in the buffer
        Parameters:
        position -
      • andWord

        void andWord​(int position,
                     long mask)
        Replaces the word at the given position in the buffer with its bitwise-and with the given mask.
        Parameters:
        position -
        mask -
      • orWord

        void orWord​(int position,
                    long mask)
        Replaces the word at the given position in the buffer with its bitwise-or with the given mask.
        Parameters:
        position -
        mask -
      • andLastWord

        void andLastWord​(long mask)
        Replaces the last word position in the buffer with its bitwise-and with the given mask.
        Parameters:
        mask -
      • orLastWord

        void orLastWord​(long mask)
        Replaces the last word position in the buffer with its bitwise-or with the given mask.
        Parameters:
        mask -
      • expand

        void expand​(int position,
                    int length)
        Expands the buffer by adding the given number of words at the given position. The added words may contain stale data.
        Parameters:
        position - the position of the buffer where to add words
        length - the number of words to add
      • collapse

        void collapse​(int position,
                      int length)
        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.
        Parameters:
        position - the position of the buffer where to add words
        length - the number of words to add
      • clone

        Buffer clone()
              throws java.lang.CloneNotSupportedException
        Creates and returns a copy of the buffer
        Throws:
        java.lang.CloneNotSupportedException
      • swap

        void swap​(Buffer other)
        Swap the content of the buffer with another.
        Parameters:
        other - buffer to swap with