Class BitVec

java.lang.Object
tripleplay.util.BitVec

public final class BitVec extends Object
A bit vector. We'd use Java's BitSet, but GWT doesn't support it. Note that we also use int instead of long to be GWT/JavaScript-friendly. TODO: maybe use super-source to use longs by default but int for GWT?
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a bit vector with an initial capacity of 16 words.
    BitVec(int words)
    Creates a bit vector with the specified initial capacity (in words).
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears all bits in this vector.
    void
    clear(int value)
    Clears the valueth bit.
    boolean
    isSet(int value)
    Returns whether the valueth bit it set.
    void
    set(int value)
    Sets the valueth bit.
    void
    set(BitVec other)
    Copies the contents of other to this bit vector.
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • BitVec

      public BitVec()
      Creates a bit vector with an initial capacity of 16 words.
    • BitVec

      public BitVec(int words)
      Creates a bit vector with the specified initial capacity (in words).
  • Method Details

    • isSet

      public boolean isSet(int value)
      Returns whether the valueth bit it set.
    • set

      public void set(int value)
      Sets the valueth bit.
    • set

      public void set(BitVec other)
      Copies the contents of other to this bit vector.
    • clear

      public void clear(int value)
      Clears the valueth bit.
    • clear

      public void clear()
      Clears all bits in this vector.
    • toString

      public String toString()
      Overrides:
      toString in class Object