Exemplo n.º 1
0
 /// <summary>
 /// Inserts the specified entity.
 /// </summary>
 /// <param name="thesaurusWordObject">The thesaurusWord object</param>
 public void Insert(ThesaurusWord thesaurusWordObject)
 {
     if (!_wordCache.ContainsKey(thesaurusWordObject.GetKey()))
     {
         _wordCache.Add(thesaurusWordObject.GetKey(), thesaurusWordObject);
         _wordStore.Insert(thesaurusWordObject);
         // _wordStore.Save("thesaurus.json");
     }
 }
        /// <summary>
        /// Inserts the specified thesaurus word
        /// </summary>
        /// <param name="thesaurusWord">The thesaurus word</param>
        public void Insert(ThesaurusWord thesaurusWord)
        {
            if (thesaurusWord == null)
            {
                return;
            }

            if (!_thesaurusWordsDictionary.ContainsKey(thesaurusWord.GetKey()))
            {
                _thesaurusWordsDictionary.Add(thesaurusWord.GetKey(), thesaurusWord);
            }
            else
            {
                _thesaurusWordsDictionary[thesaurusWord.GetKey()] = thesaurusWord;
            }
        }
 /// <summary>
 /// Deletes the specified thesaurus word
 /// </summary>
 /// <param name="thesaurusWord">The thesaurus word</param>
 /// <exception cref="System.NotImplementedException"></exception>
 public void Delete(ThesaurusWord thesaurusWord)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 4
0
        /// <summary>
        /// Returns all of the synonyms for a specified word
        /// </summary>
        /// <param name="thesaurusWord">The thesaurus word upon which to find synonyms</param>
        /// <returns>An IEnumerable<string> of synonyms</returns>
        public IEnumerable <string> GetSynonyms(string thesaurusWord)
        {
            ThesaurusWord targetThesaurusWord = _thesaurusWordCache.GetByWord(thesaurusWord);

            return(targetThesaurusWord == null?Enumerable.Empty <string>() : targetThesaurusWord.GetSynonyms());
        }
Exemplo n.º 5
0
 /// <summary>
 /// Deletes the specified entity.
 /// </summary>
 /// <param name="thesaurusWordObject">The thesaurusWord Object</param>
 public void Delete(ThesaurusWord thesaurusWordObject)
 {
     _wordCache.Remove(thesaurusWordObject.GetKey());
     _wordStore.Delete(thesaurusWordObject);
 }