Class CompleteBitField

java.lang.Object
org.klomp.snark.BitField
org.klomp.snark.CompleteBitField

public class CompleteBitField extends BitField
A full bitfield, immutable, to save memory and time. Overrides all methods except size().
Since:
0.9.71
  • Field Summary

    Fields inherited from class org.klomp.snark.BitField

    size
  • Constructor Summary

    Constructors
    Constructor
    Description
    CompleteBitField(int size)
    Creates a new BitField that represents size set bits.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    clear(int bit)
    Sets the given bit to false.
    boolean
    Return true if all bits are set.
    int
    Return the number of set bits.
    boolean
     
    boolean
    get(int bit)
    Return true if the bit is set or false if it is not.
    byte[]
    This returns the actual byte array used.
    int
     
    void
    set(int bit)
    Sets the given bit to true.
    void
    Sets all bits to true.
     

    Methods inherited from class org.klomp.snark.BitField

    size

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CompleteBitField

      public CompleteBitField(int size)
      Creates a new BitField that represents size set bits.
  • Method Details

    • getFieldBytes

      public byte[] getFieldBytes()
      Description copied from class: BitField
      This returns the actual byte array used. Changes to this array affect this BitField. Note that some bits at the end of the byte array are supposed to be always unset if they represent bits bigger then the size of the bitfield. Caller should synch on this and copy!
      Overrides:
      getFieldBytes in class BitField
    • set

      public void set(int bit)
      Description copied from class: BitField
      Sets the given bit to true.
      Overrides:
      set in class BitField
    • clear

      public void clear(int bit)
      Description copied from class: BitField
      Sets the given bit to false.
      Overrides:
      clear in class BitField
    • setAll

      public void setAll()
      Description copied from class: BitField
      Sets all bits to true.
      Overrides:
      setAll in class BitField
    • get

      public boolean get(int bit)
      Description copied from class: BitField
      Return true if the bit is set or false if it is not.
      Overrides:
      get in class BitField
    • count

      public int count()
      Description copied from class: BitField
      Return the number of set bits.
      Overrides:
      count in class BitField
    • complete

      public boolean complete()
      Description copied from class: BitField
      Return true if all bits are set.
      Overrides:
      complete in class BitField
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class BitField
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class BitField
    • toString

      public String toString()
      Overrides:
      toString in class BitField