public static TokenCollection ToCollection(string input) { var output = new TokenCollection(); foreach (char c in input) { var element = char.ToLower(c); if (!_register.Keys.Contains(element)) { var allowedElements = string.Join(",", _register.Keys); var msg = $"Input sequence contains invalid element, accepted elements are [{allowedElements}]"; throw new ArgumentException(msg, nameof(input)); } output.AddTokens(_register[element], 1); } return(output); }
public void CollectTokens(TokenCollection tokens) => _tokensInternal.AddTokens(tokens);
public void AddTokensToBoard(TokenCollection tokensToReturnToBoard) => _boardTokensInternal.AddTokens(tokensToReturnToBoard);