MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / removeHeapNode

Method removeHeapNode

JSAT/src/jsat/utils/IntPriorityQueue.java:321–339  ·  view source on GitHub ↗

Removes the node specified from the heap @param i the valid heap node index to remove from the heap @return the value that was stored in the heap node

(int i)

Source from the content-addressed store, hash-verified

319 * @return the value that was stored in the heap node
320 */
321 protected int removeHeapNode(int i)
322 {
323 int val = heap[i];
324 int rightMost = --size;
325 heap[i] = heap[rightMost];
326 heap[rightMost] = 0;
327 if(fastValueRemove == Mode.HASH)
328 {
329 valueIndexMap.remove(val);
330 if(size != 0)
331 valueIndexMap.put(heap[i], i);
332 }
333 else if(fastValueRemove == Mode.BOUNDED)
334 {
335 valueIndexStore[val] = -1;
336 }
337 heapDown(i);
338 return val;
339 }
340
341 private int rightChild(int i)
342 {

Callers 2

removeMethod · 0.95
pollMethod · 0.95

Calls 3

heapDownMethod · 0.95
removeMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected