/* */ public void changed(int index) { /* 183 */ int pos = this.inv[index]; /* 184 */ if (pos < 0) throw new IllegalArgumentException("Index " + index + " does not belong to the queue"); /* 185 */ int newPos = CharIndirectHeaps.upHeap(this.refArray, this.heap, this.inv, this.size, pos, this.c); /* 186 */ CharIndirectHeaps.downHeap( this.refArray, this.heap, this.inv, this.size, newPos, this.c); /* */ }
/* */ public boolean remove(int index) /* */ { /* 198 */ int result = this.inv[index]; /* 199 */ if (result < 0) return false; /* 200 */ this.inv[index] = -1; /* */ /* 202 */ if (result < --this.size) /* */ { /* */ int tmp53_52 = this.heap[this.size]; this.heap[result] = tmp53_52; this.inv[tmp53_52] = result; /* 204 */ int newPos = CharIndirectHeaps.upHeap(this.refArray, this.heap, this.inv, this.size, result, this.c); /* 205 */ CharIndirectHeaps.downHeap( this.refArray, this.heap, this.inv, this.size, newPos, this.c); /* */ } /* */ /* 208 */ return true; /* */ }
/* */ public void enqueue(int x) { /* 156 */ if (this.inv[x] >= 0) throw new IllegalArgumentException("Index " + x + " belongs to the queue"); /* 157 */ if (this.size == this.heap.length) this.heap = IntArrays.grow(this.heap, this.size + 1); /* */ int tmp83_82 = x; this.heap[this.size] = tmp83_82; this.inv[tmp83_82] = (this.size++); /* */ /* 161 */ CharIndirectHeaps.upHeap( this.refArray, this.heap, this.inv, this.size, this.size - 1, this.c); /* */ }
/* */ public CharHeapIndirectPriorityQueue( char[] refArray, int[] a, int size, CharComparator c) /* */ { /* 107 */ this(refArray, 0, c); /* 108 */ this.heap = a; /* 109 */ this.size = size; /* 110 */ int i = size; /* 111 */ while (i-- != 0) { /* 112 */ if (this.inv[a[i]] != -1) throw new IllegalArgumentException("Index " + a[i] + " appears twice in the heap"); /* 113 */ this.inv[a[i]] = i; /* */ } /* 115 */ CharIndirectHeaps.makeHeap(refArray, a, this.inv, size, c); /* */ }
/* */ public int dequeue() { /* 169 */ if (this.size == 0) throw new NoSuchElementException(); /* 170 */ int result = this.heap[0]; /* 171 */ if (--this.size != 0) /* */ { /* */ int tmp54_53 = this.heap[this.size]; this.heap[0] = tmp54_53; this.inv[tmp54_53] = 0; /* 172 */ } this.inv[result] = -1; /* */ /* 174 */ if (this.size != 0) CharIndirectHeaps.downHeap(this.refArray, this.heap, this.inv, this.size, 0, this.c); /* 175 */ return result; /* */ }
/* */ public void changed() { /* 179 */ CharIndirectHeaps.downHeap(this.refArray, this.heap, this.inv, this.size, 0, this.c); /* */ }
/* */ public void allChanged() /* */ { /* 193 */ CharIndirectHeaps.makeHeap(this.refArray, this.heap, this.inv, this.size, this.c); /* */ }