public void KeysISorted() { ISorted <string> keys = dict.Keys; Assert.IsTrue(keys.IsReadOnly); Assert.AreEqual("R", keys.FindMin()); Assert.AreEqual("T", keys.FindMax()); Assert.IsTrue(keys.Contains("S")); Assert.AreEqual(3, keys.Count); // This doesn't hold, maybe because the dict uses a special key comparer? // Assert.IsTrue(keys.SequencedEquals(new WrappedArray<string>(new string[] { "R", "S", "T" }))); Assert.IsTrue(keys.UniqueItems().All(delegate(String s) { return(s == "R" || s == "S" || s == "T"); })); Assert.IsTrue(keys.All(delegate(String s) { return(s == "R" || s == "S" || s == "T"); })); Assert.IsFalse(keys.Exists(delegate(String s) { return(s != "R" && s != "S" && s != "T"); })); String res; Assert.IsTrue(keys.Find(delegate(String s) { return(s == "R"); }, out res)); Assert.AreEqual("R", res); Assert.IsFalse(keys.Find(delegate(String s) { return(s == "Q"); }, out res)); Assert.AreEqual(null, res); }
internal void Flush(long ts) { while (!list.IsEmpty) { var first = list.FindMin(); if (first.ts < ts) { list.DeleteMin(); } else { break; } } }
/// <summary> /// /// </summary> /// <returns></returns> public KeyValuePair <K, V> FindMin() { return(sortedpairs.FindMin()); }
/// <summary> /// Find the minimum of the wrapped collection /// </summary> /// <returns>The minimum</returns> public T FindMin() { return(sorted.FindMin()); }