private void CreateDigitsDictionary()
        {
            this.digitsDictionary = new Dictionary <DigitRepresentation, List <string> >();

            foreach (LCDDigit lcdDigit in lcdNumber.GetLCDDigits())
            {
                if (!this.digitsDictionary.ContainsKey(lcdDigit.DigitRepresentation))
                {
                    this.digitsDictionary.Add(lcdDigit.DigitRepresentation, LCDTextListFactory.Create(lcdDigit, this.width, this.height));
                }
            }
        }
Пример #2
0
        private Dictionary <DigitRepresentation, List <string> > CreateDigitsDictionary(LCDNumber lcdNumber, int width, int height)
        {
            Dictionary <DigitRepresentation, List <string> > digitsDictionary = new Dictionary <DigitRepresentation, List <string> >();

            foreach (LCDDigit lcdDigit in lcdNumber.GetLCDDigits())
            {
                if (!digitsDictionary.ContainsKey(lcdDigit.DigitRepresentation))
                {
                    digitsDictionary.Add(lcdDigit.DigitRepresentation, LCDTextListFactory.Create(lcdDigit, width, height));
                }
            }

            return(digitsDictionary);
        }
Пример #3
0
        public LCDNumberPrinter(LCDNumber lcdNumber, int width, int height) : base()
        {
            Dictionary <DigitRepresentation, List <string> > digitsDictionary = this.CreateDigitsDictionary(lcdNumber, width, height);
            int total = 3 + 2 * (height - 1);

            for (int i = 0; i < total; i++)
            {
                StringBuilder sb = new StringBuilder();
                foreach (LCDDigit lcdDigit in lcdNumber.GetLCDDigits())
                {
                    sb.Append(digitsDictionary[lcdDigit.DigitRepresentation][i]);
                }
                this.IncludeLine(sb.ToString());
            }
        }