public void FuzzyMatch(InputKey[] actualKeys, InputKey[] expectedKeys, InputKeyMatch expected)
        {
            var actualSet   = new InputKeyIndex(actualKeys);
            var expectedSet = new InputKeyIndex(expectedKeys);

            var result = actualSet.FuzzyMatch(expectedSet);

            Assert.Equal(expected, result);
        }
        /// <summary>
        /// Search all comboes and return the ones that start with the same sequence.
        /// </summary>
        /// <return>The found combos; otherwise empty array if nothing was found.</return>
        public SequenceCombo[] Search(params InputKey[] keys)
        {
            var result = new List <SequenceCombo>();
            var query  = new InputKeyIndex(keys);

            foreach (var item in this.Items)
            {
                if (item.Index.Match(query, true))
                {
                    result.Add(item);
                }
            }

            return(result.ToArray());
        }
        /// <summary>
        /// Fuzzy Search all comboes and return the ones that start with the same sequence.
        /// </summary>
        /// <return>The found combos; otherwise null if nothing was found</return>
        public SequenceCombo[] FuzzySearch(int fuzzy, params InputKey[] keys)
        {
            var result = new List <SequenceCombo>();
            var query  = new InputKeyIndex(keys);

            foreach (var item in this.Items)
            {
                var queryResult = item.Index.FuzzyMatch(query, fuzzy);
                if (queryResult == InputKeyMatch.FullMatch ||
                    queryResult == InputKeyMatch.PartialMatch)
                {
                    result.Add(item);
                }
            }

            return(result.ToArray());
        }
Exemple #4
0
 public SequenceCombo(string name, params InputKey[] keys)
 {
     this.Name  = name;
     this.Keys  = keys;
     this.Index = new InputKeyIndex(keys);
 }