Interface BitVector

All Known Subinterfaces:
RankedBitVector
All Known Implementing Classes:
BitVectorImpl, RankedBitVectorImpl

public interface BitVector
Interface for a bit vector.
Author:
Julian Mendez
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    addBit(boolean bit)
    Appends a bit to this bit vector.
    boolean
    Returns true if and only if the specified object is also a BitVector and both contain the same bits in the same order.
    boolean
    getBit(long position)
    This is the "access" method of bit vectors.
     
    void
    setBit(long position, boolean bit)
    Sets a bit at a particular position.
    long
     
  • Method Details

    • equals

      boolean equals(Object o)
      Returns true if and only if the specified object is also a BitVector and both contain the same bits in the same order.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to be compared with this BitVector
      Returns:
      true if and only if the specified object is also a BitVector and both contain the same bits in the same order
    • getBit

      boolean getBit(long position)
      This is the "access" method of bit vectors.
      Returns:
      value of a bit at position
      Throws:
      IndexOutOfBoundsException - if the position is out of range
    • size

      long size()
      Returns:
      size of this bit vector
    • iterator

      Iterator<Boolean> iterator()
      Returns:
      an iterator for this bit vector
    • addBit

      boolean addBit(boolean bit)
      Appends a bit to this bit vector.
      Returns:
      true if the element was successfully added
    • setBit

      void setBit(long position, boolean bit)
      Sets a bit at a particular position.
      Parameters:
      position - position
      bit - bit
      Throws:
      IndexOutOfBoundsException - if the position is out of range