AIMA.Core.Util.Math.MixedRadixNumber.calculateMaxValue C# (CSharp) Method

calculateMaxValue() private method

private calculateMaxValue ( ) : void
return void
        private void calculateMaxValue()
        {
            if (0 == radixs.Length)
            {
                throw new InvalidOperationException(
                        "At least 1 radix must be defined.");
            }
            for (int i = 0; i < radixs.Length; i++)
            {
                if (radixs[i] < 2)
                {
                    throw new InvalidOperationException(
                            "Invalid radix, must be >= 2");
                }
            }

            // Calcualte the maxValue allowed
            maxValue = radixs[0];
            for (int i = 1; i < radixs.Length; i++)
            {
                maxValue *= radixs[i];
            }
            maxValue -= 1;

            if (value > maxValue)
            {
                throw new InvalidOperationException(
                        "The value ["
                                + value
                                + "] cannot be represented with the radixs provided, max value is "
                                + maxValue);
            }

            currentNumeralValue = new int[radixs.Length];
        }
    }