# Cloud Firestore V1 Client - Class BitSequence (2.2.0-RC1)

2.2.0-RC1 2.1.0 (latest) 2.0.2-RC1 1.55.0 1.54.4 1.53.1 1.52.0 1.51.0 1.50.0 1.48.1 1.47.3 1.46.0 1.45.2 1.44.1 1.43.3 1.40.0 1.39.0 1.38.0 1.37.7 1.36.1 1.35.0 1.34.0 1.33.0 1.32.0 1.31.0 1.30.0 1.28.0 1.27.3 Reference documentation and code samples for the Cloud Firestore V1 Client class BitSequence.

A sequence of bits, encoded in a byte array.

Each byte in the `bitmap` byte array stores 8 bits of the sequence. The only
exception is the last byte, which may store 8 *or fewer* bits. The `padding`
defines the number of bits of the last byte to be ignored as "padding". The
values of these "padding" bits are unspecified and must be ignored.
To retrieve the first bit, bit 0, calculate: `(bitmap[0] & 0x01) != 0`.
To retrieve the second bit, bit 1, calculate: `(bitmap[0] & 0x02) != 0`.
To retrieve the third bit, bit 2, calculate: `(bitmap[0] & 0x04) != 0`.
To retrieve the fourth bit, bit 3, calculate: `(bitmap[0] & 0x08) != 0`.
To retrieve bit n, calculate: `(bitmap[n / 8] & (0x01 << (n % 8))) != 0`.
The "size" of a `BitSequence` (the number of bits it contains) is calculated
by this formula: `(bitmap.length * 8) - padding`.

Generated from protobuf message `google.firestore.v1.BitSequence`

## Namespace

Google \\ Cloud \\ Firestore \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ bitmap` | `string` The bytes that encode the bit sequence. May have a length of zero. |
| `↳ padding` | `int` The number of bits of the last byte in `bitmap` to ignore as "padding". If the length of `bitmap` is zero, then this value must be `0`. Otherwise, this value must be between 0 and 7, inclusive. |

### getBitmap

The bytes that encode the bit sequence.

May have a length of zero.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setBitmap

The bytes that encode the bit sequence.

May have a length of zero.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPadding

The number of bits of the last byte in `bitmap` to ignore as "padding".

If the length of `bitmap` is zero, then this value must be `0`.
Otherwise, this value must be between 0 and 7, inclusive.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setPadding

The number of bits of the last byte in `bitmap` to ignore as "padding".

If the length of `bitmap` is zero, then this value must be `0`.
Otherwise, this value must be between 0 and 7, inclusive.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |