コード例 #1
0
 /// <summary>Ensures that heap is wrapped in a synchronous wrapper.</summary>
 /// <param name="heap">The heap to be wrapped.</param>
 /// <returns>A synchronized wrapper for the heap.</returns>
 public static ChoBinaryHeap Synchronize(ChoBinaryHeap heap)
 {
     // Create a synchronization wrapper around the heap and return it.
     if (heap is SyncChoBinaryHeap)
     {
         return(heap);
     }
     return(new SyncChoBinaryHeap(heap));
 }
コード例 #2
0
 /// <summary>Initialize the heap with another heap.</summary>
 /// <param name="heap">The heap on which to perform a shallow-copy.</param>
 public ChoBinaryHeap(ChoBinaryHeap <T> heap)
 {
     // Clone the list (the only state we have)
     _list = (ChoList <T>)heap._list.Clone();
 }