コード例 #1
0
        /// <summary>
        /// Sets or clears the bits in the alarm state mask.
        /// </summary>
        /// <param name="bits">The bits.</param>
        /// <param name="isSet">if set to <c>true</c> the bits are set; otherwise they are cleared.</param>
        /// <returns>True if the state changed as a result of setting the bits.</returns>
        public bool SetStateBits(UnderlyingSystemAlarmStates bits, bool isSet)
        {
            if (isSet)
            {
                var currentlySet = (State & bits) == bits;
                State |= bits;
                return(!currentlySet);
            }

            var currentlyCleared = (State & ~bits) == State;

            State &= ~bits;
            return(!currentlyCleared);
        }
コード例 #2
0
        /// <summary>
        /// Sets or clears the bits in the alarm state mask.
        /// </summary>
        /// <param name="bits">The bits.</param>
        /// <param name="isSet">if set to <c>true</c> the bits are set; otherwise they are cleared.</param>
        /// <returns>True if the state changed as a result of setting the bits.</returns>
        public bool SetStateBits(UnderlyingSystemAlarmStates bits, bool isSet)
        {
            if (isSet)
            {
                bool currentlySet = ((m_state & bits) == bits);
                m_state |= bits;
                return(!currentlySet);
            }

            bool currentlyCleared = ((m_state & ~bits) == m_state);

            m_state &= ~bits;
            return(!currentlyCleared);
        }
コード例 #3
0
        /// <summary>
        /// Sets or clears the bits in the alarm state mask.
        /// </summary>
        /// <param name="bits">The bits.</param>
        /// <param name="isSet">if set to <c>true</c> the bits are set; otherwise they are cleared.</param>
        /// <returns>True if the state changed as a result of setting the bits.</returns>
        public bool SetStateBits(UnderlyingSystemAlarmStates bits, bool isSet)
        {
            if (isSet)
            {
                bool currentlySet = ((m_state & bits) == bits);
                m_state |= bits;
                return !currentlySet;
            }

            bool currentlyCleared = ((m_state & ~bits) == m_state);
            m_state &= ~bits;
            return !currentlyCleared;
        }