Beispiel #1
0
        // Iterate over ]x1...]
        public static void IterExcEnd <T>(ISorted <T> coll, T x1)
            where T : IComparable <T>
        {
            var x1HasSucc = Successor(coll, x1, out var x1Succ);
            IDirectedEnumerable <T> range = x1HasSucc ? coll.RangeFrom(x1Succ) : new ArrayList <T>();

            Print(range);
        }
        // Iterate over [x1...]

        public static void IterIncEnd <T>(ISorted <T> coll, T x1)
        {
            foreach (T x in coll.RangeFrom(x1))
            {
                Console.Write("{0} ", x);
            }
            Console.WriteLine();
        }
Beispiel #3
0
    // Iterate over [x1...x2]
    public static void IterIncInc <T>(ISorted <T> coll, T x1, T x2)
        where T : IComparable <T>
    {
        var x2HasSucc = Successor(coll, x2, out var x2Succ);
        IDirectedEnumerable <T> range = x2HasSucc ? coll.RangeFromTo(x1, x2Succ) : coll.RangeFrom(x1);

        Print(range);
    }
Beispiel #4
0
        // Iterate over ]x1...x2]
        public static void IterExcInc <T>(ISorted <T> coll, T x1, T x2)
            where T : IComparable <T>
        {
            var x1HasSucc = Successor(coll, x1, out T x1Succ);
            var x2HasSucc = Successor(coll, x2, out T x2Succ);
            IDirectedEnumerable <T> range = x1HasSucc
                ? (x2HasSucc ? coll.RangeFromTo(x1Succ, x2Succ) : coll.RangeFrom(x1Succ))
                : new ArrayList <T>();

            Print(range);
        }
Beispiel #5
0
        // Iterate over ]x1...]

        public static void IterExcEnd <T>(ISorted <T> coll, T x1)
            where T : IComparable <T>
        {
            bool x1HasSucc = Successor(coll, x1, out T x1Succ);
            IDirectedEnumerable <T> range =
                x1HasSucc ? coll.RangeFrom(x1Succ) : new ArrayList <T>();

            foreach (T x in range)
            {
                Console.Write("{0} ", x);
            }
            Console.WriteLine();
        }
Beispiel #6
0
        // Iterate over [x1...x2]

        public static void IterIncInc <T>(ISorted <T> coll, T x1, T x2)
            where T : IComparable <T>
        {
            bool x2HasSucc = Successor(coll, x2, out T x2Succ);
            IDirectedEnumerable <T> range =
                x2HasSucc ? coll.RangeFromTo(x1, x2Succ) : coll.RangeFrom(x1);

            foreach (T x in range)
            {
                Console.Write("{0} ", x);
            }
            Console.WriteLine();
        }
        // Iterate over ]x1...x2]

        public static void IterExcInc <T>(ISorted <T> coll, T x1, T x2)
            where T : IComparable <T>
        {
            T    x1Succ, x2Succ;
            bool x1HasSucc = Successor(coll, x1, out x1Succ),
                 x2HasSucc = Successor(coll, x2, out x2Succ);
            IDirectedEnumerable <T> range =
                x1HasSucc ? (x2HasSucc ? coll.RangeFromTo(x1Succ, x2Succ)
                                     : coll.RangeFrom(x1Succ))
                        : new ArrayList <T>();

            foreach (T x in range)
            {
                Console.Write("{0} ", x);
            }
            Console.WriteLine();
        }
Beispiel #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="bot"></param>
 /// <returns></returns>
 public IDirectedEnumerable <KeyValuePair <K, V> > RangeFrom(K bot)
 {
     return(sortedpairs.RangeFrom(new KeyValuePair <K, V>(bot)));
 }
Beispiel #9
0
        // Iterate over [x1...]
        public static void IterIncEnd <T>(ISorted <T> coll, T x1)
        {
            var range = coll.RangeFrom(x1);

            Print(range);
        }
Beispiel #10
0
 /// <summary>
 /// Get the specified range from the wrapped collection.
 /// (The current implementation erroneously does not wrap the result.)
 /// </summary>
 /// <param name="bot"></param>
 /// <returns></returns>
 public IDirectedEnumerable <T> RangeFrom(T bot)
 {
     return(sorted.RangeFrom(bot));
 }