예제 #1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="TimeSignature" /> with the specified
        ///     numerator and denominator.
        /// </summary>
        /// <param name="numerator">Numerator of the time signature which defines number of beats.</param>
        /// <param name="denominator">Denominator of the time signature which defines beat length.</param>
        /// <exception cref="ArgumentOutOfRangeException">
        ///     <paramref name="numerator" /> is zero or negative. -or-
        ///     <paramref name="denominator" /> is zero or negative. -or- <paramref name="denominator" /> is not a
        ///     power of two.
        /// </exception>
        public TimeSignature(int numerator, int denominator)
        {
            ThrowIfArgument.IsNonpositive(nameof(numerator), numerator, "Numerator is zero or negative.");
            ThrowIfArgument.IsNonpositive(nameof(denominator), denominator, "Denominator is zero or negative.");
            ThrowIfArgument.DoesntSatisfyCondition(nameof(denominator),
                                                   denominator,
                                                   MathUtilities.IsPowerOfTwo,
                                                   "Denominator is not a power of two.");

            Numerator   = numerator;
            Denominator = denominator;
        }