public void Enqueue(T t, TPriority priority) { if (Count == Heap.Length) { ExpandHeap(); } Heap[Count] = new ValuePriority <T, TPriority>(t, priority); BubbleUp(Count); Count++; }
public void UpdateValueFromIndex(ValuePriorityIndex pIndex, TPriority newPriority) { if (pIndex.Version != _version) { throw new InvalidOperationException("The priority queue was modified after the index was retrieved."); } int index = pIndex.Index; _heap[index] = new ValuePriority <T, TPriority>(_heap[index].Value, newPriority); _version++; }
public bool Equals(ValuePriority <T, TPriority> other) { return(Value.Equals(other.Value) && Priority.Equals(other.Priority)); }