예제 #1
0
 public void clear()
 {
     dict.Clear();
     if (size > 0)
     {
         if (com != null)
         {
             queue = new C5.IntervalHeap <T>(size, com);
         }
         else
         {
             queue = new C5.IntervalHeap <T>(size);
         }
     }
     else
     if (com != null)
     {
         queue = new C5.IntervalHeap <T>(com);
     }
     else
     {
         queue = new C5.IntervalHeap <T>();
     }
 }
예제 #2
0
 /// <summary>
 /// 创建包含指定优先队列中元素的 PriorityQueue
 /// 根据指定优先队列的比较器来排序元素
 /// </summary>
 /// <param name="q"></param>
 public IntervalHeap_C5(IPriorityQueue <T> q)
 {
     com   = q.getComparator();
     size  = q.getSize();
     queue = new C5.IntervalHeap <T>(size, com);
 }
예제 #3
0
 /// <summary>
 /// 使用指定的初始容量创建一个 PriorityQueue
 /// 并根据指定的比较器来排序其元素
 /// </summary>
 /// <param name="initialCapacity"></param>
 /// <param name="comparator"></param>
 public IntervalHeap_C5(int initialCapacity, IComparer <T> comparator)
 {
     com   = comparator;
     size  = initialCapacity;
     queue = new C5.IntervalHeap <T>(size, com);
 }
예제 #4
0
 /// <summary>
 /// 使用默认的初始容量(11)创建一个 PriorityQueue
 /// 并根据指定的比较器来排序其元素
 /// </summary>
 /// <param name="comparator"></param>
 public IntervalHeap_C5(IComparer <T> comparator)
 {
     com   = comparator;
     queue = new C5.IntervalHeap <T>(com);
 }
예제 #5
0
 /// <summary>
 /// 使用指定的初始容量创建一个 PriorityQueue
 /// 并根据其自然顺序来排序其元素(使用 Comparable)
 /// </summary>
 /// <param name="initialCapacity"></param>
 public IntervalHeap_C5(int initialCapacity)
 {
     size  = initialCapacity;
     queue = new C5.IntervalHeap <T>(size);
 }
예제 #6
0
 /// <summary>
 /// 使用默认的初始容量(11)创建一个 PriorityQueue
 /// 并根据其自然顺序来排序其元素(使用 Comparable)
 /// </summary>
 public IntervalHeap_C5()
 {
     queue = new C5.IntervalHeap <T>();
 }