/// <summary> /// Reapply the prioritization function to each of the updates currently /// stored in the priority queues. /// </summary public void Reprioritize(UpdatePriorityHandler handler) { MinHeapItem item; foreach (LookupItem lookup in new List <LookupItem>(m_lookupTable.Values)) { if (lookup.Heap.TryGetValue(lookup.Handle, out item)) { uint pqueue = item.PriorityQueue; uint localid = item.Value.Entity.LocalId; if (handler(ref pqueue, item.Value.Entity)) { // unless the priority queue has changed, there is no need to modify // the entry pqueue = Util.Clamp <uint>(pqueue, 0, NumberOfQueues - 1); if (pqueue != item.PriorityQueue) { lookup.Heap.Remove(lookup.Handle); LookupItem litem = lookup; litem.Heap = m_heaps[pqueue]; litem.Heap.Add(new MinHeapItem(pqueue, item), ref litem.Handle); m_lookupTable[localid] = litem; } } else { // m_log.WarnFormat("[PQUEUE]: UpdatePriorityHandler returned false for {0}",item.Value.Entity.UUID); lookup.Heap.Remove(lookup.Handle); m_lookupTable.Remove(localid); } } } }
/// <summary> /// Reapply the prioritization function to each of the updates currently /// stored in the priority queues. /// </summary public void Reprioritize(UpdatePriorityHandler handler) { int pqueue = 0; foreach (EntityUpdate currentEU in m_lookupTable.Values) { if (handler(ref pqueue, currentEU.Entity)) { // unless the priority queue has changed, there is no need to modify // the entry if (pqueue != currentEU.PriorityQueue) { m_heaps[currentEU.PriorityQueue].RemoveAt(currentEU.PriorityQueueIndex); currentEU.PriorityQueue = pqueue; m_heaps[pqueue].Add(currentEU); } } else { break; } } }
public virtual void ReprioritizeUpdates(StateUpdateTypes type, UpdatePriorityHandler handler) { }
public void ReprioritizeUpdates(StateUpdateTypes type, UpdatePriorityHandler handler) { throw new System.NotImplementedException(); }