Class: Google::Apis::FirestoreV1::BitSequence

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/firestore_v1/classes.rb,
lib/google/apis/firestore_v1/representations.rb,
lib/google/apis/firestore_v1/representations.rb

Overview

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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ BitSequence

Returns a new instance of BitSequence.



367
368
369
# File 'lib/google/apis/firestore_v1/classes.rb', line 367

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#bitmapString

The bytes that encode the bit sequence. May have a length of zero. Corresponds to the JSON property bitmap NOTE: Values are automatically base64 encoded/decoded in the client library.

Returns:

  • (String)


358
359
360
# File 'lib/google/apis/firestore_v1/classes.rb', line 358

def bitmap
  @bitmap
end

#paddingFixnum

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. Corresponds to the JSON property padding

Returns:

  • (Fixnum)


365
366
367
# File 'lib/google/apis/firestore_v1/classes.rb', line 365

def padding
  @padding
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



372
373
374
375
# File 'lib/google/apis/firestore_v1/classes.rb', line 372

def update!(**args)
  @bitmap = args[:bitmap] if args.key?(:bitmap)
  @padding = args[:padding] if args.key?(:padding)
end