Package fj.data.hamt

Class BitSet

java.lang.Object
fj.data.hamt.BitSet

public final class BitSet extends Object
A sequence of bits representing a value. The most significant bit (the bit with the highest value) is the leftmost bit and has the highest index. For example, the BitSet("1011") represents the decimal number 11 and has indices [3, 0] inclusive where the bit with the lowest value has the lowest index and is the rightmost bit.
  • Field Details

  • Constructor Details

    • BitSet

      private BitSet(long l)
  • Method Details

    • empty

      public static BitSet empty()
    • longBitSet

      public static BitSet longBitSet(long l)
    • listBitSet

      public static BitSet listBitSet(List<Boolean> list)
    • streamBitSet

      public static BitSet streamBitSet(Stream<Boolean> s)
    • stringBitSet

      public static BitSet stringBitSet(String s)
    • isSet

      public boolean isSet(int index)
    • isEmpty

      public boolean isEmpty()
    • set

      public BitSet set(int index)
    • set

      public BitSet set(int index, boolean b)
    • clear

      public BitSet clear(int index)
    • longValue

      public long longValue()
    • and

      public BitSet and(BitSet bs)
    • or

      public BitSet or(BitSet bs)
    • shiftRight

      public BitSet shiftRight(int n)
    • shiftLeft

      public BitSet shiftLeft(int n)
    • bitsUsed

      public int bitsUsed()
    • bitsOn

      public int bitsOn()
    • toStream

      public Stream<Boolean> toStream()
      Returns a stream of boolean where the head is the most significant bit (the bit with the largest value)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • bitsToRight

      public int bitsToRight(int index)
    • toList

      public List<Boolean> toList()
    • foldRight

      public <A> A foldRight(F2<Boolean,A,A> f, A acc)
    • foldLeft

      public <A> A foldLeft(F2<A,Boolean,A> f, A acc)
    • xor

      public BitSet xor(BitSet bs)
    • not

      public BitSet not()
    • takeLower

      public BitSet takeLower(int n)
    • takeUpper

      public BitSet takeUpper(int n)
    • range

      public BitSet range(int highIndex, int lowIndex)
      Returns the bit set from indices in the range from low (inclusive) to high(exclusive) from the least significant bit (on the right), e.g. "101101".range(1, 4) == "0110"
    • toBoolean

      public static boolean toBoolean(char c)
    • toBoolean

      public static boolean toBoolean(int i)
    • toInt

      public static int toInt(boolean b)
    • asString

      public String asString()