Ejemplo n.º 1
0
            public string getName(string value)
            {
                bool negative = false;

                if (value.StartsWith("-"))
                {
                    negative = true;
                    value    = value.Substring(1);
                }

                int    decimals     = value.IndexOf(".");
                string decimalValue = null;

                if (0 <= decimals)
                {
                    decimalValue = value.Substring(decimals + 1);
                    value        = value.Substring(0, decimals);
                }

                string name = processor.getName(value);

                string[] separatorarray = { SEPARATOR };
                string[] namearray      = { name };

                if (String.IsNullOrEmpty(name))
                {
                    name = ZERO_TOKEN;
                }
                else if (negative)
                {
                    name = MINUS + SEPARATOR + name;
                }

                if (!(null == decimalValue || String.IsNullOrEmpty(decimalValue)))
                {
                    name = name + SEPARATOR + UNION_AND + SEPARATOR + processor.getName(decimalValue) +
                           SEPARATOR + SCALE.getName(-decimalValue.Length);
                }

                return(name);
            }
Ejemplo n.º 2
0
            public string getName(string value)
            {
                StringBuilder buffer = new StringBuilder();

                int number;

                if (String.IsNullOrEmpty(value))
                {
                    number = 0;
                }
                else if (value.Length > 4)
                {
                    number = Convert.ToInt32(value.Substring(value.Length - 4), 10);
                }
                else
                {
                    number = Convert.ToInt32(value, 10);
                }
                number %= 1000;  // keep at least three digits

                if (number >= 100)
                {
                    buffer.Append(unitProcessor.getName(number / 100));
                    buffer.Append(SEPARATOR);
                    buffer.Append(SCALE.getName(EXPONENT));
                }

                string tensName = tensProcessor.getName(number % 100);

                if (!String.IsNullOrEmpty(tensName) && (number >= 100))
                {
                    buffer.Append(SEPARATOR);
                }
                buffer.Append(tensName);

                return(buffer.ToString());
            }
Ejemplo n.º 3
0
 public string getToken()
 {
     return(SCALE.getName(getPartDivider()));
 }