Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        // 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();
        }
Ejemplo n.º 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);
    }
Ejemplo n.º 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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 7
0
        // 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();
        }
Ejemplo n.º 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)));
 }
Ejemplo n.º 9
0
        // Iterate over [x1...]
        public static void IterIncEnd <T>(ISorted <T> coll, T x1)
        {
            var range = coll.RangeFrom(x1);

            Print(range);
        }
Ejemplo n.º 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));
 }