Esempio n. 1
0
        // 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();
        }
Esempio n. 3
0
        // 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();
        }
Esempio n. 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="top"></param>
 /// <returns></returns>
 public IDirectedEnumerable <KeyValuePair <K, V> > RangeTo(K top)
 {
     return(sortedpairs.RangeTo(new KeyValuePair <K, V>(top)));
 }
Esempio n. 5
0
        // Iterate over [...x2[
        public static void IterBeginExc <T>(ISorted <T> coll, T x2)
        {
            var range = coll.RangeTo(x2);

            Print(range);
        }
Esempio n. 6
0
 /// <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));
 }