Class BitSet
java.lang.Object
fj.data.hamt.BitSet
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final BitSetstatic final intstatic final intstatic final intstatic final intprivate final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasString()intbitsOn()intbitsToRight(int index) intbitsUsed()clear(int index) static BitSetempty()boolean<A> A<A> AbooleanisEmpty()booleanisSet(int index) static BitSetlistBitSet(List<Boolean> list) static BitSetlongBitSet(long l) longnot()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.set(int index) set(int index, boolean b) shiftLeft(int n) shiftRight(int n) static BitSetstatic BitSettakeLower(int n) takeUpper(int n) static booleantoBoolean(char c) static booleantoBoolean(int i) static inttoInt(boolean b) toList()toStream()Returns a stream of boolean where the head is the most significant bit (the bit with the largest value)toString()
-
Field Details
-
TRUE_BIT
public static final int TRUE_BIT- See Also:
-
FALSE_BIT
public static final int FALSE_BIT- See Also:
-
EMPTY
-
BASE_LONG
public static final long BASE_LONG- See Also:
-
MAX_BIT_SIZE
public static final int MAX_BIT_SIZE- See Also:
-
MAX_BIT_INDEX
public static final int MAX_BIT_INDEX- See Also:
-
value
private final long value
-
-
Constructor Details
-
BitSet
private BitSet(long l)
-
-
Method Details
-
empty
-
longBitSet
-
listBitSet
-
streamBitSet
-
stringBitSet
-
isSet
public boolean isSet(int index) -
isEmpty
public boolean isEmpty() -
set
-
set
-
clear
-
longValue
public long longValue() -
and
-
or
-
shiftRight
-
shiftLeft
-
bitsUsed
public int bitsUsed() -
bitsOn
public int bitsOn() -
toStream
-
toString
-
equals
-
bitsToRight
public int bitsToRight(int index) -
toList
-
foldRight
-
foldLeft
-
xor
-
not
-
takeLower
-
takeUpper
-
range
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
-