コード例 #1
0
 /// <summary>
 /// Initializes the priority queue with the specified ordering delegate and zero initial capacity.
 /// </summary>
 /// <param name="areOrdered">The delegate that will indicate if two items are ordered properly.</param>
 public DelegateOrderedPriorityQueue(AreOrderedDelegate areOrdered)
 {
     if (areOrdered == null)
     {
         throw new ArgumentNullException("areOrdered");
     }
     _areOrdered = areOrdered;
 }
コード例 #2
0
 /// <summary>
 /// Initializes the priority queue with the specified ordering delegate and a specified initial capacity.
 /// </summary>
 /// <param name="areOrdered">The delegate that will indicate if two items are ordered properly.</param>
 /// <param name="initialCapacity">The number of items for which underlying storage capacity will be allocated immediately.</param>
 public DelegateOrderedPriorityQueue(AreOrderedDelegate areOrdered, int initialCapacity)
     : base(initialCapacity)
 {
     if (areOrdered == null)
     {
         throw new ArgumentNullException("areOrdered");
     }
     _areOrdered = areOrdered;
 }
コード例 #3
0
        /// <summary>
        /// Removes all elements from the queue, and sets a new <see cref="AreOrderedDelegate"/> functor which will be applied to any elements pushed later on.
        /// </summary>
        /// <param name="areOrdered">The delegate that will indicate if two items are ordered properly.</param>
        /// <remarks>This does not deallocate any memory used by the internal data structure.
        /// It therefore enables reuse of the priority queue instance to cut down on the cost
        /// of allocation and garbage collection.</remarks>
        public void Reset(AreOrderedDelegate areOrdered)
        {
            if (areOrdered == null)
            {
                throw new ArgumentNullException("areOrdered");
            }

            Clear();
            _areOrdered = areOrdered;
        }