示例#1
0
        protected Numbers(string numbersText)
        {
            NUMBER_TEXT_APPEND_FORMAT = "{0} ";
            NUMBER_PATTERN            = @"^\d(\d{0,}\.?)\d{0,}$";

            if (!Check(numbersText))
            {
                throw new FormatException("Invalid number text");
            }
            numericalStructure = NumericalStructure.Initialise().Reverse(); //Reverse the sorting order to allow retrieveing the first number description that has value smaller than the given number.
            NumberText         = numbersText;
        }
示例#2
0
        public static NumericalStructure Initialise()
        {
            NumericalStructure result = null;

            using (Stream resourceStream = typeof(NumericalStructure).Assembly.GetManifestResourceStream("AKQA.BL.NumberStructure.json"))
            {
                using (StreamReader reader = new StreamReader(resourceStream))
                {
                    result = JsonConvert.DeserializeObject <NumericalStructure>(reader.ReadToEnd());
                }
            }
            return(result);
        }