\Zxing\CommonBitArray

<p>A simple, fast array of bits, represented compactly by an array of ints internally.</p>

Summary

Methods
Properties
Constants
__construct()
getSize()
getSizeInBytes()
set()
flip()
getNextSet()
getNextUnset()
setBulk()
setRange()
clear()
isRange()
appendBits()
appendBit()
appendBitArray()
_xor()
toBytes()
get()
getBitArray()
reverse()
equals()
hashCode()
toString()
_clone()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
makeArray()
ensureCapacity()
$bits
$size
N/A

Properties

Methods

__construct()

__construct(mixed  $bits = [], mixed  $size) : mixed

Parameters

mixed $bits
mixed $size

Returns

mixed —

getSize()

getSize() : mixed

Returns

mixed —

getSizeInBytes()

getSizeInBytes() : mixed

Returns

mixed —

set()

set(\Zxing\Common\bit  $i) : void

Sets bit i.

Parameters

\Zxing\Common\bit $i

to set

flip()

flip(\Zxing\Common\bit  $i) : void

Flips bit i.

Parameters

\Zxing\Common\bit $i

to set

getNextSet()

getNextSet(\Zxing\Common\first  $from) : \Zxing\Common\index

Parameters

\Zxing\Common\first $from

bit to check

Returns

\Zxing\Common\index —

of first bit that is set, starting from the given index, or size if none are set at or beyond this given index

getNextUnset()

getNextUnset(\Zxing\Common\index  $from) : \Zxing\Common\index

Parameters

\Zxing\Common\index $from

to start looking for unset bit

Returns

\Zxing\Common\index —

of next unset bit, or {@code size} if none are unset until the end

setBulk()

setBulk(\Zxing\Common\first  $i, \Zxing\Common\the  $newBits) : void

Sets a block of 32 bits, starting at bit i.

Parameters

\Zxing\Common\first $i

bit to set

\Zxing\Common\the $newBits

new value of the next 32 bits. Note again that the least-significant bit corresponds to bit i, the next-least-significant to i+1, and so on.

setRange()

setRange(\Zxing\Common\start  $start, \Zxing\Common\end  $end) : mixed

Sets a range of bits.

Parameters

\Zxing\Common\start $start

of range, inclusive.

\Zxing\Common\end $end

of range, exclusive

Returns

mixed —

clear()

clear() : void

Clears all bits (sets to false).

isRange()

isRange(\Zxing\Common\start  $start, \Zxing\Common\end  $end, \Zxing\Common\if  $value) : true

Efficient method to check if a range of bits is set, or not set.

Parameters

\Zxing\Common\start $start

of range, inclusive.

\Zxing\Common\end $end

of range, exclusive

\Zxing\Common\if $value

true, checks that bits in range are set, otherwise checks that they are not set

Throws

\Zxing\Common\InvalidArgumentException

if end is less than or equal to start

Returns

true —

iff all bits are set or not set in range, according to value argument

appendBits()

appendBits( $value, \Zxing\Common\bits  $numBits) : mixed

Appends the least-significant bits, from value, in order from most-significant to least-significant. For example, appending 6 bits from 0x000001E will append the bits 0, 1, 1, 1, 1, 0 in that order.

Parameters

$value

{@code int} containing bits to append

\Zxing\Common\bits $numBits

from value to append

Returns

mixed —

appendBit()

appendBit(mixed  $bit) : void

Parameters

mixed $bit

appendBitArray()

appendBitArray(mixed  $other) : void

Parameters

mixed $other

_xor()

_xor(mixed  $other) : mixed

Parameters

mixed $other

Returns

mixed —

toBytes()

toBytes(\Zxing\Common\first  $bitOffset, array  $array, \Zxing\Common\position  $offset, \Zxing\Common\how  $numBytes) : void

Parameters

\Zxing\Common\first $bitOffset

bit to start writing

array $array

to write into. Bytes are written most-significant byte first. This is the opposite of the internal representation, which is exposed by {@link #getBitArray()}

\Zxing\Common\position $offset

in array to start writing

\Zxing\Common\how $numBytes

many bytes to write

get()

get( $i) : true

Parameters

$i

; bit to get

Returns

true —

iff bit i is set

getBitArray()

getBitArray() : array

Returns

array —

underlying array of ints. The first element holds the first 32 bits, and the least significant bit is bit 0.

reverse()

reverse() : void

Reverses all bits in the array.

equals()

equals(mixed  $o) : mixed

Parameters

mixed $o

Returns

mixed —

hashCode()

hashCode() : mixed

Returns

mixed —

toString()

toString() : mixed

Returns

mixed —

_clone()

_clone() : \Zxing\Common\BitArray

Returns

\Zxing\Common\BitArray —

makeArray()

makeArray(mixed  $size) : mixed

Parameters

mixed $size

Returns

mixed —

ensureCapacity()

ensureCapacity(mixed  $size) : void

Parameters

mixed $size