예제 #1
0
        public void TrySetValue()
        {
            var possibleValues = DigitModelHelper.GetDigitsByBarsNumber(DigitModel.Count);

            if (!possibleValues.Any())
            {
                return;
            }

            foreach (var value in possibleValues)
            {
                var model = DigitModelHelper.GetDigitModel(value);
                if (DigitModelHelper.AreEqualModels(model, DigitModel))
                {
                    DigitValue = value;
                    return;
                }
            }
        }
예제 #2
0
        public List <int> GetAlternativeValues()
        {
            var lines        = DigitModel.Count;
            var alternatives = DigitModelHelper.GetDigitsByBarsNumber(lines + 1);

            alternatives.AddRange(DigitModelHelper.GetDigitsByBarsNumber(lines - 1));

            var result = new List <int>();

            foreach (var alternativeValue in alternatives)
            {
                var model = DigitModelHelper.GetDigitModel(alternativeValue);
                if (DigitModelHelper.AreInterchangeableModels(model, DigitModel))
                {
                    result.Add(alternativeValue);
                }
            }

            return(result);
        }