// Helper Method private MatchedWord BuildMatchedWord(string scrambledWord, string word) { MatchedWord matchedWord = new MatchedWord { ScrambledWord = scrambledWord, Word = word }; return(matchedWord); }
private MatchedWord BuildMatchedWord(string scrambledWord, string word) { MatchedWord matchedWord = new MatchedWord(); matchedWord.ScrambledWord = scrambledWord; matchedWord.Word = word; return(matchedWord); }
}//end Match method //Helper Methods private MatchedWord BuildMatchedWord(string scrambleWords, string word) { MatchedWord _matchedWord = new MatchedWord { ScrambledWord = scrambleWords, CorrectWord = word }; return(_matchedWord); }
private MatchedWord BuildMatchedWord(string scrambledWord, string word) { //MatchedWord matchedword = new MatchedWord(); //matchedword.ScrambledWord = scrambledWord; //matchedword.Word = word; MatchedWord matchedWord = new MatchedWord { ScrambledWord = scrambledWord, Word = word }; return(matchedWord); }
public Word GetLongestMatchingWords() { List <string> matchingWords = new List <string>(); Word word = new Word(); string path = System.Web.HttpContext.Current.Request.MapPath("~\\NET Test 00.txt"); if (File.Exists(path)) { var wordsFromFile = File.ReadAllLines(path).ToList().OrderByDescending(x => x.Length).ToList(); if (!(wordsFromFile == null)) { matchingWords = MatchedWord.GetLongestWords(wordsFromFile).OrderByDescending(x => x.Length).ToList(); word.words.AddRange(matchingWords.Take(2).ToList()); word.count = matchingWords.Count; } } return(word); }
public List <MatchedWord> Match(string[] scrambledWords, string[] wordList) { var matchedWords = new List <MatchedWord>(); foreach (var scrambledWord in scrambledWords) { foreach (var word in wordList) { if (scrambledWord.Equals(word, StringComparison.OrdinalIgnoreCase)) { matchedWords.Add(BuildMatchedWord(scrambledWord, word)); } else { var scrambledWordArray = scrambledWord.ToCharArray(); var wordArray = word.ToCharArray(); Array.Sort(scrambledWordArray); Array.Sort(wordArray); var sortedScrambledWord = new string(scrambledWordArray); var sortedWord = new string(wordArray); if (sortedScrambledWord.Equals(sortedWord, StringComparison.OrdinalIgnoreCase)) { matchedWords.Add(BuildMatchedWord(scrambledWord, word)); } } } } MatchedWord BuildMatchedWord(string scrambledWord, string word) { MatchedWord matchedWord = new MatchedWord() { ScrambledWord = scrambledWord, Word = word }; return(matchedWord); } return(matchedWords); }
public void Visit(MatchedWord word, byte data) => Visit((None)null, data);
public void Visit(MatchedWord word, byte data) => Content.Add(word.Name);