public virtual void TestTreeMapIterator() { TwoDimensionalMap <string, string, string> map = new TwoDimensionalMap <string, string, string>(MapFactory.TreeMapFactory <string, IDictionary <string, string> >(), MapFactory.TreeMapFactory <string, string>()); map.Put("A", "B", "C"); map.Put("Z", "Y", "X"); map.Put("Z", "B", "C"); map.Put("A", "Y", "X"); map.Put("D", "D", "D"); map.Put("D", "F", "E"); map.Put("K", "G", "B"); map.Put("G", "F", "E"); map.Put("D", "D", "E"); // sneaky overwritten entry NUnit.Framework.Assert.AreEqual(8, map.Size()); IEnumerator <TwoDimensionalMap.Entry <string, string, string> > mapIterator = map.GetEnumerator(); TwoDimensionalMap.Entry <string, string, string> entry = mapIterator.Current; NUnit.Framework.Assert.AreEqual("A", entry.GetFirstKey()); NUnit.Framework.Assert.AreEqual("B", entry.GetSecondKey()); NUnit.Framework.Assert.AreEqual("C", entry.GetValue()); entry = mapIterator.Current; NUnit.Framework.Assert.AreEqual("A", entry.GetFirstKey()); NUnit.Framework.Assert.AreEqual("Y", entry.GetSecondKey()); NUnit.Framework.Assert.AreEqual("X", entry.GetValue()); entry = mapIterator.Current; NUnit.Framework.Assert.AreEqual("D", entry.GetFirstKey()); NUnit.Framework.Assert.AreEqual("D", entry.GetSecondKey()); NUnit.Framework.Assert.AreEqual("E", entry.GetValue()); entry = mapIterator.Current; NUnit.Framework.Assert.AreEqual("D", entry.GetFirstKey()); NUnit.Framework.Assert.AreEqual("F", entry.GetSecondKey()); NUnit.Framework.Assert.AreEqual("E", entry.GetValue()); entry = mapIterator.Current; NUnit.Framework.Assert.AreEqual("G", entry.GetFirstKey()); NUnit.Framework.Assert.AreEqual("F", entry.GetSecondKey()); NUnit.Framework.Assert.AreEqual("E", entry.GetValue()); entry = mapIterator.Current; NUnit.Framework.Assert.AreEqual("K", entry.GetFirstKey()); NUnit.Framework.Assert.AreEqual("G", entry.GetSecondKey()); NUnit.Framework.Assert.AreEqual("B", entry.GetValue()); entry = mapIterator.Current; NUnit.Framework.Assert.AreEqual("Z", entry.GetFirstKey()); NUnit.Framework.Assert.AreEqual("B", entry.GetSecondKey()); NUnit.Framework.Assert.AreEqual("C", entry.GetValue()); entry = mapIterator.Current; NUnit.Framework.Assert.AreEqual("Z", entry.GetFirstKey()); NUnit.Framework.Assert.AreEqual("Y", entry.GetSecondKey()); NUnit.Framework.Assert.AreEqual("X", entry.GetValue()); NUnit.Framework.Assert.IsFalse(mapIterator.MoveNext()); IEnumerator <string> valueIterator = map.ValueIterator(); NUnit.Framework.Assert.IsTrue(valueIterator.MoveNext()); NUnit.Framework.Assert.AreEqual("C", valueIterator.Current); NUnit.Framework.Assert.AreEqual("X", valueIterator.Current); NUnit.Framework.Assert.AreEqual("E", valueIterator.Current); NUnit.Framework.Assert.AreEqual("E", valueIterator.Current); NUnit.Framework.Assert.AreEqual("E", valueIterator.Current); NUnit.Framework.Assert.AreEqual("B", valueIterator.Current); NUnit.Framework.Assert.AreEqual("C", valueIterator.Current); NUnit.Framework.Assert.AreEqual("X", valueIterator.Current); NUnit.Framework.Assert.IsFalse(valueIterator.MoveNext()); }
public static Edu.Stanford.Nlp.Util.TwoDimensionalMap <K1, K2, V> TreeMap <K1, K2, V>() { return(new Edu.Stanford.Nlp.Util.TwoDimensionalMap <K1, K2, V>(MapFactory.TreeMapFactory <K1, IDictionary <K2, V> >(), MapFactory.TreeMapFactory <K2, V>())); }