예제 #1
0
        public IEnumerator <string> GetAlternatives(string partialName)
        {
            // first test, if we find the name directly
            IEnumerator <string> testIt = SubsetCollection <string> .Tail(nameSet, partialName).GetEnumerator();

            string testMatch = (testIt.MoveNext()) ? (string)testIt.Current : null;

            if (testMatch == null || !testMatch.StartsWith(partialName))
            {
                string canonical = partialName.ToLower();
                testIt = SubsetDictionary <string, string> .Tail(canonicalNames, canonical).Keys.GetEnumerator();

                testMatch = (testIt.MoveNext()) ? (string)testIt.Current : null;
                if (testMatch == null || !testMatch.StartsWith(canonical))
                {
                    return(null);                    // nope.
                }
                string foundName = (string)canonicalNames[testMatch];
                partialName = foundName.Substring(0, partialName.Length);
            }

            return(new NameEnumerator(this, partialName));
        }
예제 #2
0
 public ICollection <string> GetRegisteredCommandNames(string key)
 {
     // return commandMap.TailDictionary(key).Keys;
     return(SubsetDictionary <string, Command> .Tail(commandMap, key).Keys);
 }