// Iterate over [...x2] public static void IterBeginInc <T>(ISorted <T> coll, T x2) where T : IComparable <T> { var x2HasSucc = Successor(coll, x2, out var x2Succ); IDirectedEnumerable <T> range = x2HasSucc ? coll.RangeTo(x2Succ) : coll.RangeAll(); Print(range); }
// Iterate over [...x2[ public static void IterBeginExc <T>(ISorted <T> coll, T x2) { foreach (T x in coll.RangeTo(x2)) { Console.Write("{0} ", x); } Console.WriteLine(); }
// Iterate over [...x2] public static void IterBeginInc <T>(ISorted <T> coll, T x2) where T : IComparable <T> { bool x2HasSucc = Successor(coll, x2, out T x2Succ); IDirectedEnumerable <T> range = x2HasSucc ? coll.RangeTo(x2Succ) : coll.RangeAll(); foreach (T x in range) { Console.Write("{0} ", x); } Console.WriteLine(); }
/// <summary> /// /// </summary> /// <param name="top"></param> /// <returns></returns> public IDirectedEnumerable <KeyValuePair <K, V> > RangeTo(K top) { return(sortedpairs.RangeTo(new KeyValuePair <K, V>(top))); }
// Iterate over [...x2[ public static void IterBeginExc <T>(ISorted <T> coll, T x2) { var range = coll.RangeTo(x2); Print(range); }
/// <summary> /// Get the specified range from the wrapped collection. /// (The current implementation erroneously does not wrap the result.) /// </summary> /// <param name="top"></param> /// <returns></returns> public IDirectedEnumerable <T> RangeTo(T top) { return(sorted.RangeTo(top)); }