equal
deleted
inserted
replaced
151 void pop() { |
151 void pop() { |
152 rmidx(0); |
152 rmidx(0); |
153 } |
153 } |
154 |
154 |
155 void erase(const Item &i) { |
155 void erase(const Item &i) { |
156 rmidx(iim.get(i)); |
156 rmidx(iim[i]); |
157 } |
157 } |
158 |
158 |
159 Prio get(const Item &i) const { |
159 Prio get(const Item &i) const { |
160 int idx = iim.get(i); |
160 int idx = iim[i]; |
161 return data[idx].second; |
161 return data[idx].second; |
162 } |
162 } |
163 Prio operator[](const Item &i) const { |
163 Prio operator[](const Item &i) const { |
164 return get(i); |
164 return get(i); |
165 } |
165 } |
166 void set(const Item &i, const Prio &p) { |
166 void set(const Item &i, const Prio &p) { |
167 int idx = iim.get(i); |
167 int idx = iim[i]; |
168 if( idx < 0 ) { |
168 if( idx < 0 ) { |
169 push(i,p); |
169 push(i,p); |
170 } |
170 } |
171 else if( comp(p, data[idx].second) ) { |
171 else if( comp(p, data[idx].second) ) { |
172 bubble_up(idx, PairType(i,p)); |
172 bubble_up(idx, PairType(i,p)); |
175 bubble_down(idx, PairType(i,p), data.size()); |
175 bubble_down(idx, PairType(i,p), data.size()); |
176 } |
176 } |
177 } |
177 } |
178 |
178 |
179 void decrease(const Item &i, const Prio &p) { |
179 void decrease(const Item &i, const Prio &p) { |
180 int idx = iim.get(i); |
180 int idx = iim[i]; |
181 bubble_up(idx, PairType(i,p)); |
181 bubble_up(idx, PairType(i,p)); |
182 } |
182 } |
183 void increase(const Item &i, const Prio &p) { |
183 void increase(const Item &i, const Prio &p) { |
184 int idx = iim.get(i); |
184 int idx = iim[i]; |
185 bubble_down(idx, PairType(i,p), data.size()); |
185 bubble_down(idx, PairType(i,p), data.size()); |
186 } |
186 } |
187 |
187 |
188 state_enum state(const Item &i) const { |
188 state_enum state(const Item &i) const { |
189 int s = iim.get(i); |
189 int s = iim[i]; |
190 if( s>=0 ) |
190 if( s>=0 ) |
191 s=0; |
191 s=0; |
192 return state_enum(s); |
192 return state_enum(s); |
193 } |
193 } |
194 |
194 |