Ejemplo n.º 1
0
        /// <summary>
        ///   Creates a digit instance
        /// </summary>
        /// <param name="buffer">
        ///   A number string, in which the digit is located
        /// </param>
        /// <param name="bufferPosition">
        ///   The index of the digit in a <c>buffer</c>
        /// </param>
        public Digit(string buffer, int bufferPosition)
        {
            int digit = int.Parse(buffer[bufferPosition].ToString());

            int digitPosition = getDigitPosition(buffer, bufferPosition);

            BasePlaceValue basePlaceValue = getBasePlaceValue(digitPosition);

            BigPlaceValue bigPlaceValue = getBigPlaceValue(digitPosition);

            this.digit          = digit;
            this.basePlaceValue = basePlaceValue;
            this.bigPlaceValue  = bigPlaceValue;
        }
Ejemplo n.º 2
0
        /// <summary>
        ///   Compose a Polish extension word for a big place value
        /// </summary>
        /// <param name="digit">
        ///   The digit used to determine which extension to use
        /// </param>
        /// <param name="bigPlaceValue">
        ///   The BigPlaceValue used to determine which extension to use
        /// </param>
        /// <returns>
        ///  A Polish word extension for the BigPlaceValue
        /// </returns>
        private string composeBigPlaceValueExtensionWord(int digit, BigPlaceValue bigPlaceValue)
        {
            if (digit == 0)
            {
                return("");
            }

            int wordExtensionIndex = getCommonPolishWordExtensionIndex(digit);

            string word;

            switch (bigPlaceValue)
            {
            case BigPlaceValue.None:
            default:
                return("");

            case BigPlaceValue.Thousands:
                word = ThousandsEndings[wordExtensionIndex];
                break;

            case BigPlaceValue.Millions:
                word = MillionsEndings[wordExtensionIndex];
                break;

            case BigPlaceValue.Billions:
                word = BillionsEndings[wordExtensionIndex];
                break;

            case BigPlaceValue.Trillions:
                word = TrillionsEndings[wordExtensionIndex];
                break;
            }

            return(word);
        }