Package fj.data.hamt

Class BitSet


  • public final class BitSet
    extends java.lang.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.
    • Constructor Detail

      • BitSet

        private BitSet​(long l)
    • Method Detail

      • empty

        public static BitSet empty()
      • longBitSet

        public static BitSet longBitSet​(long l)
      • listBitSet

        public static BitSet listBitSet​(List<java.lang.Boolean> list)
      • streamBitSet

        public static BitSet streamBitSet​(Stream<java.lang.Boolean> s)
      • stringBitSet

        public static BitSet stringBitSet​(java.lang.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()
      • shiftRight

        public BitSet shiftRight​(int n)
      • shiftLeft

        public BitSet shiftLeft​(int n)
      • bitsUsed

        public int bitsUsed()
      • bitsOn

        public int bitsOn()
      • toStream

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

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • bitsToRight

        public int bitsToRight​(int index)
      • toList

        public List<java.lang.Boolean> toList()
      • foldRight

        public <A> A foldRight​(F2<java.lang.Boolean,​A,​A> f,
                               A acc)
      • foldLeft

        public <A> A foldLeft​(F2<A,​java.lang.Boolean,​A> f,
                              A acc)
      • 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 java.lang.String asString()