/// <summary> /// Returns the ith coordinate of this vector. /// </summary> /// <param name="i">i the index</param> /// <returns>the value of the ith coordinate of this vector</returns> /// <exception cref="IndexOutOfRangeException">unless i is between 0 and d-1</exception> public double Get(int i) { if (i < 0 || i >= _dims) { throw new IndexOutOfRangeException("Illegal index"); } if (_st.Contains(i)) { return(_st.Get(i)); } return(0.0); }
public void CreateIndex(string fileName, IEnumerable <string> words) { foreach (var word in words) { if (!_st.Contains(word)) { _st.Put(word, new SET <string>()); } var set = _st.Get(word); set.Add(fileName); } }
public void CreateLookup(string key, IEnumerable <string> values) { foreach (var value in values) { if (!_st.Contains(key)) { _st.Put(key, new Collections.Queue <string>()); } if (!_ts.Contains(value)) { _ts.Put(value, new Collections.Queue <string>()); } _st.Get(key).Enqueue(value); _ts.Get(value).Enqueue(key); } }
public void InsertWord(string key) { if (key.Length < MINLEN) { return; } _words++; if (_st.Contains(key)) { _st.Put(key, _st.Get(key) + 1); } else { _st.Put(key, 1); _distinct++; } }
public void Check(string key) { Console.WriteLine(_st.Contains(key) ? _st.Get(key) : "Not found"); }