public static T9Dictionary CreateFrom(Dictionary <char, int[]> dict) { var t9Dictionary = new T9Dictionary(); foreach (var item in dict) { t9Dictionary.Add(item.Key, T9ButtonCombination.CreateFromDigits(item.Value)); } return(t9Dictionary); }
public string GetValue(char c) { T9ButtonCombination combination; if (dictionary.TryGetValue(c, out combination)) { string result = string.Empty; if (previousChar != null && previousChar.ShouldWaitPause(combination)) { result += pauseSymbol; } result += combination.ToString(); previousChar = combination; return(result); } else { throw new ConvertionDictionaryException($"Dictionary doesn't contain char '{c}'"); } }
public bool ShouldWaitPause(T9ButtonCombination other) { return(this.Buttons[0] == other.Buttons[0]); }
public void Reset() { previousChar = null; }
public void Add(char c, T9ButtonCombination buttons) { dictionary.Add(c, buttons); }