public void TestGetKeyByValueChangeValue() { CyclingHash hash = new CyclingHash(); for (int i = 0; i < 1000; i++) { hash.Add(i, i % 10); } List <int> objsA = new List <int>(hash.ReadByValue(9, -1, 10).Cast <int>()); for (int i = 0; i < objsA.Count; i++) { Assert.IsTrue(objsA[i] == 999 - i * 10); } }
public void TestGetKeyByValue() { CyclingHash hash = new CyclingHash(); for (int i = 0; i < 1000; i++) { hash.Add(i, i % 10); } List <int> objs = new List <int>(hash.ReadByValue("2", null, 101).Cast <int>()); for (int i = 0; i < objs.Count; i++) { Assert.IsTrue(objs[i] == 992 - i * 10); } }
public void TestGetKeyByValueChangeValue() { CyclingHash hash = new CyclingHash(); for (int i = 0; i < 1000; i++) { hash.Add(i, i % 10); } List<int> objsA = new List<int>(hash.ReadByValue(9, -1, 10).Cast<int>()); for (int i = 0; i < objsA.Count; i++) { Assert.IsTrue(objsA[i] == 999 - i * 10); } }
public void TestGetKeyByValue() { CyclingHash hash = new CyclingHash(); for (int i = 0; i < 1000; i++) { hash.Add(i, i % 10); } List<int> objs = new List<int>(hash.ReadByValue("2", null, 101).Cast<int>()); for (int i = 0; i < objs.Count; i++) { Assert.IsTrue(objs[i] == 992 - i * 10); } }
/// <summary> /// 通过值获取关键词集合 /// </summary> /// <param name="value"></param> /// <param name="changeValue"></param> /// <param name="topN"></param> /// <returns></returns> private IEnumerable <object> GetKeyByValue(object value, object changeValue, int topN) { return(_table.ReadByValue(value, changeValue, topN)); }