Пример #1
0
        /// <summary>
        /// Return clone of element.
        /// </summary>
        /// <returns>Clone of elements.</returns>
        public object Clone()
        {
            HeapWithAttachments <TValue, TAttachments> clone = new HeapWithAttachments <TValue, TAttachments>();

            clone.count        = count;
            clone.elements     = new HeapEntry[elements.Length];
            clone.isHeap       = isHeap;
            clone.ListTreshold = ListTreshold;
            Array.Copy(elements, clone.elements, count);
            clone.comparer = this.comparer;
            return(clone);
        }
Пример #2
0
 /// <summary>
 /// Get isHeap field from heap(true if it is real heap, not sorted list).
 /// </summary>
 /// <typeparam name="TValue">TValue.</typeparam>
 /// <typeparam name="TAttachments">TAttachments</typeparam>
 /// <param name="heap">Heap</param>
 /// <returns>true if it is real heap, not sorted list</returns>
 public static bool IsHeap <TValue, TAttachments>(HeapWithAttachments <TValue, TAttachments> heap)
 {
     return(heap.isHeap);
 }
Пример #3
0
 /// <summary>
 /// Get internal array with heap's entries
 /// </summary>
 /// <typeparam name="TValue">TValue</typeparam>
 /// <typeparam name="TAttachments">TAttachments</typeparam>
 /// <param name="heap">Heap</param>
 /// <returns>Internal array with heap's entries</returns>
 public static HeapWithAttachments <TValue, TAttachments> .HeapEntry[] GetEntries <TValue, TAttachments>(HeapWithAttachments <TValue, TAttachments> heap)
 {
     return(heap.elements);
 }
Пример #4
0
 internal HeapEnumerator(HeapWithAttachments <TValue, TAttachments> heap)
 {
     this.heap = heap;
     index     = -1;
     version   = heap.version;
 }