Abstraction of types that are conceptually a sequence of bits, and may be the subject of bitwise operations. A bit is a Boolean value. Bits are indexed from right to left, where 0 is the index of the least significant bit.

By: Stef
See also Integer

no type hierarchy

no supertypes hierarchy

Attributes
notSource Codeshared formal Other not

The binary complement of this sequence of bits.

Inherited Attributes
Attributes inherited from: Object
Methods
andSource Codeshared formal Other and(Other other)

Performs a logical AND operation.

clearSource Codeshared default Other clear(Integer index)

Returns an instance with the given bit set to 0 if 0 <= index < size, otherwise returns a value with the same bits as this value.

flipSource Codeshared formal Other flip(Integer index)

Returns an instance with the given bit flipped to its opposite value if 0 <= index < size, otherwise returns a value with the same bits as this value.

getSource Codeshared formal Boolean get(Integer index)

Retrieves a given bit from this bit sequence if 0 <= index < size, otherwise returns false.

leftLogicalShiftSource Codeshared formal Other leftLogicalShift(Integer shift)

Shift the sequence of bits to the left, by the given number of places, filling the least significant bits with zeroes.

orSource Codeshared formal Other or(Other other)

Performs a logical inclusive OR operation.

rightArithmeticShiftSource Codeshared formal Other rightArithmeticShift(Integer shift)

Shift the sequence of bits to the right, by the given number of places, preserving the values of the most significant bits.

If the sequence of bits represents a signed integer, the sign is preserved.

rightLogicalShiftSource Codeshared formal Other rightLogicalShift(Integer shift)

Shift the sequence of bits to the right, by the given number of places, filling the most significant bits with zeroes.

If the sequence of bits represents a signed integer, the sign is not preserved.

setSource Codeshared formal Other set(Integer index, Boolean bit = true)

Returns an instance with the given bit set to the given value if 0 <= index < size, otherwise returns a value with the same bits as this value.

Parameters:
  • bit = true
xorSource Codeshared formal Other xor(Other other)

Performs a logical exclusive OR operation.

Inherited Methods
Methods inherited from: Object