Ejemplo n.º 1
0
        /// <summary>
        /// Fills the bit array with the corresponding values.
        /// </summary>
        /// <param name="bitArray">The bit array.</param>
        protected override void FillBitArray(BitArray bitArray)
        {
            bitArray[0] = false; // reserved for special addressing methods

            int currentIdx = 1;

            // add MAIN group (always 4-bit)
            foreach (bool bit in Group.ConvertToBits(4))
            {
                bitArray[currentIdx] = bit;
                currentIdx++;
            }

            // add MIDDLE group (3-bit, but it's not mandatory)
            if (MiddleGroup != null)
            {
                foreach (bool bit in MiddleGroup.ConvertToBits(3))
                {
                    bitArray[currentIdx] = bit;
                    currentIdx++;
                }
            }

            var length = (byte)((MiddleGroup != null) ? 8 : 11);

            foreach (bool bit in ((int)SubGroup).ConvertToBits(length))
            {
                bitArray[currentIdx] = bit;
                currentIdx++;
            }
        }