/// <summary> /// Conditionally set the effective CrossSectional attachment level if <paramref name="value"/> is larger than <see cref="_effectiveCrossSectionalAttachmentLevel"/> /// </summary> /// <param name="value"> /// The new level to use /// </param> private void SetEffectiveXsLevel(CrossSectionalLevels value) { if (value > this._effectiveCrossSectionalAttachmentLevel) { this._effectiveCrossSectionalAttachmentLevel = value; } }
/// <summary> /// Set or unset the <paramref name="level"/> from <see cref="_crossSectionalAttachmentLevel"/>. /// Also the <see cref="_effectiveCrossSectionalAttachmentLevel"/> is set or unset depending on the current <see cref="_effectiveCrossSectionalAttachmentLevel"/> value and the <paramref name="value"/> /// </summary> /// <param name="value"> /// A value indicating whether the <paramref name="level"/> should be set or unset /// </param> /// <param name="level"> /// The <see cref="CrossSectionalLevels"/> to set or unset /// </param> private void SetLevel(bool value, CrossSectionalLevels level) { if (value) { this._crossSectionalAttachmentLevel |= level; this.SetEffectiveXsLevel(level); } else { this._crossSectionalAttachmentLevel &= ~level; if (this._effectiveCrossSectionalAttachmentLevel == level) { this._effectiveCrossSectionalAttachmentLevel = CrossSectionalLevels.None; } } }
/// <summary> /// Gets the index for cross sectional level from the specified <paramref name="level"/> /// </summary> /// <param name="level"> /// The <see cref="CrossSectionalLevels"/> /// </param> /// <returns> /// the index for cross sectional level from the specified <paramref name="level"/> /// </returns> private static int GetIndex(CrossSectionalLevels level) { var value = (int)level; return (value >> 1) - (value >> 0x3); }