예제 #1
0
        /// <summary>
        /// Splits the queue into two subqueues. The first one contains all values
        /// with priority less than <paramref cref="priority"/>, the second one all values
        /// with equal priority, and the third one values with greater priorities.
        /// </summary>
        /// <param name="priority">The priority.</param>
        /// <param name="equalGoLeft">if set to <c>true</c>, values with the priority
        /// equal to <see cref="priority"/> will be at the left side of the split; otherwise,
        /// they will be on the right side.</param>
        public Tuple <PriorityQueue <T, TPriority>, PriorityQueue <T, TPriority> > Split(TPriority priority, bool equalGoLeft)
        {
            var pair = _ft.Split(priority, equalGoLeft);

            return(Pair.New(
                       new PriorityQueue <T, TPriority>(pair.Item1),
                       new PriorityQueue <T, TPriority>(pair.Item2)));
        }
예제 #2
0
        /// <summary>
        /// Splits the sequence into two parts. The first one contains all elements less
        /// than <paramref cref="item"/>, the second one all greater elements. Elements
        /// equal to <paramref cref="item"/> go into one of them according to the
        /// <paramref name="equalGoLeft"/> parameter.
        /// </summary>
        /// <param name="item">The element on which the sequence is split.</param>
        /// <param name="equalGoLeft">if set to <c>true</c>, elements with the measure
        /// equal to <see cref="item"/> will be at the left side of the split; otherwise,
        /// they will be on the right side.</param>
        public Tuple <OrderedSequence <T>, OrderedSequence <T> > Split(T item, bool equalGoLeft)
        {
            var pair = _ft.Split(item, equalGoLeft);

            return(Pair.New(
                       new OrderedSequence <T>(pair.Item1),
                       new OrderedSequence <T>(pair.Item2)));
        }