MCPcopy Create free account
hub / github.com/BaseXdb/basex / swap

Method swap

basex-core/src/main/java/org/basex/util/MinHeap.java:109–117  ·  view source on GitHub ↗

Swaps the entries at position a and b. @param a first index @param b second index

(final int a, final int b)

Source from the content-addressed store, hash-verified

107 * @param b second index
108 */
109 private void swap(final int a, final int b) {
110 if(a == b) return;
111 final int k1 = 2 * a, v1 = k1 + 1, k2 = 2 * b, v2 = k2 + 1;
112 final Object k = vals[k1], v = vals[v1];
113 vals[k1] = vals[k2];
114 vals[v1] = vals[v2];
115 vals[k2] = k;
116 vals[v2] = v;
117 }
118
119 /**
120 * Verifies the inner structure of the heap.

Callers 2

insertMethod · 0.95
removeMinMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected