internal ICollection <SearchResultFromHead2Left <TValue> > FindFromHead2Left(SsWord headWord) { var ss = default(SortedSet <SearchResultFromHead2Left <TValue> >); var finder = Finder.Create(_root); int index = 0; for (var word = headWord; word != null; word = word.next) { var node = finder.Find(word.valueOriginal); if (node.HasNgrams) { foreach (var ngram in node.Ngrams) { var wordIndex = index - ngram.Words.Length + 1; if (wordIndex == 0) { if (ss == null) { ss = new SortedSet <SearchResultFromHead2Left <TValue> >(SearchResultOfHead2LeftComparer.Instance); } var r = ss.Add(new SearchResultFromHead2Left <TValue>(word, ngram.Words.Length, ngram.Value)); System.Diagnostics.Debug.Assert(r); } } } index++; } if (ss != null) { return(ss); } return(EMPTY_RESULT_2); }
public SearchResultFromHead2Left(SsWord lastWord, int length, TValue value) { LastWord = lastWord; Length = length; Value = value; }