Exemple #1
0
            /// <summary>
            /// Set the bit at a particular index to 1.
            /// </summary>
            /// <param name="index">Index of bit to set.</param>
            /// <returns>Returns the builder (for fluent-style composition).</returns>
            public BitmapBuilder Set(int index)
            {
                CheckIndex(index);
                bool priorValue = BitUtility.GetBit(Span, index);

                SetBitCount += priorValue ? 0 : 1;
                BitUtility.SetBit(Span, index);
                return(this);
            }
Exemple #2
0
        public bool?GetBoolean(int index)
        {
            if (IsNull(index))
            {
                return(null);
            }

            return(BitUtility.GetBit(Values, index));
        }
Exemple #3
0
            /// <summary>
            /// Set the bit at a particular index to a given value.
            /// </summary>
            /// <param name="index">Index of bit to set/unset.</param>
            /// <param name="value">Value of bit.</param>
            /// <returns>Returns the builder (for fluent-style composition).</returns>
            public BitmapBuilder Set(int index, bool value)
            {
                CheckIndex(index);
                bool priorValue = BitUtility.GetBit(Span, index);

                SetBitCount -= priorValue ? 1 : 0;
                SetBitCount += value ? 1 : 0;
                BitUtility.SetBit(Span, index, value);
                return(this);
            }
Exemple #4
0
            /// <summary>
            /// Swap the bits at two given indices.
            /// </summary>
            /// <param name="i">First index.</param>
            /// <param name="j">Second index.</param>
            /// <returns>Returns the builder (for fluent-style composition).</returns>
            public BitmapBuilder Swap(int i, int j)
            {
                CheckIndex(i);
                CheckIndex(j);
                bool bi = BitUtility.GetBit(Span, i);
                bool bj = BitUtility.GetBit(Span, j);

                BitUtility.SetBit(Span, i, bj);
                BitUtility.SetBit(Span, j, bi);
                return(this);
            }
Exemple #5
0
            public Builder Swap(int i, int j)
            {
                CheckIndex(i);
                CheckIndex(j);
                var bi = BitUtility.GetBit(ValueBuffer.Span, i);
                var bj = BitUtility.GetBit(ValueBuffer.Span, j);

                BitUtility.SetBit(ValueBuffer.Span, i, bj);
                BitUtility.SetBit(ValueBuffer.Span, j, bi);
                return(this);
            }
Exemple #6
0
        public bool?GetBoolean(int index)
        {
            if (IsNull(index))
            {
                return(null);
            }

            var span = GetSpan();

            return(BitUtility.GetBit(span, index));
        }
            private ArrowBuffer ConcatenateBitmapBuffer(int bufferIndex)
            {
                var builder = new ArrowBuffer.BitmapBuilder(_totalLength);

                foreach (ArrayData arrayData in _arrayDataList)
                {
                    int length = arrayData.Length;
                    ReadOnlySpan <byte> span = arrayData.Buffers[bufferIndex].Span;

                    for (int i = 0; i < length; i++)
                    {
                        builder.Append(span.IsEmpty || BitUtility.GetBit(span, i));
                    }
                }

                return(builder.Build(_allocator));
            }
Exemple #8
0
 public bool IsValid(int index) =>
 NullCount == 0 || NullBitmapBuffer.IsEmpty || BitUtility.GetBit(NullBitmapBuffer.Span, index);
Exemple #9
0
 public bool?GetValue(int index)
 {
     return(IsNull(index)
         ? (bool?)null
         : BitUtility.GetBit(ValueBuffer.Span, index + Offset));
 }
Exemple #10
0
 public bool IsSet(int index)
 {
     return(BitUtility.GetBit(
                Buffer.GetSpan <byte>(), index));
 }
Exemple #11
0
 public bool GetBoolean(int index)
 {
     return(BitUtility.GetBit(Values, index));
 }