@@ -203,10 +203,10 @@ class NodeBase {
203
203
VT val[N];
204
204
205
205
// / copy - Copy elements from another node.
206
- // / @param other Node elements are copied from.
206
+ // / @param Other Node elements are copied from.
207
207
// / @param i Beginning of the source range in other.
208
208
// / @param j Beginning of the destination range in this.
209
- // / @param count Number of elements to copy.
209
+ // / @param Count Number of elements to copy.
210
210
template <unsigned M>
211
211
void copy (const NodeBase<KT, VT, M> &Other, unsigned i,
212
212
unsigned j, unsigned Count) {
@@ -216,21 +216,21 @@ class NodeBase {
216
216
std::copy (Other.val + i, Other.val + i + Count, val + j);
217
217
}
218
218
219
- // / lmove - Move elements to the left.
219
+ // / moveLeft - Move elements to the left.
220
220
// / @param i Beginning of the source range.
221
221
// / @param j Beginning of the destination range.
222
- // / @param count Number of elements to copy.
223
- void lmove (unsigned i, unsigned j, unsigned Count) {
224
- assert (j <= i && " Use rmove shift elements right" );
222
+ // / @param Count Number of elements to copy.
223
+ void moveLeft (unsigned i, unsigned j, unsigned Count) {
224
+ assert (j <= i && " Use moveRight shift elements right" );
225
225
copy (*this , i, j, Count);
226
226
}
227
227
228
- // / rmove - Move elements to the right.
228
+ // / moveRight - Move elements to the right.
229
229
// / @param i Beginning of the source range.
230
230
// / @param j Beginning of the destination range.
231
- // / @param count Number of elements to copy.
232
- void rmove (unsigned i, unsigned j, unsigned Count) {
233
- assert (i <= j && " Use lmove shift elements left" );
231
+ // / @param Count Number of elements to copy.
232
+ void moveRight (unsigned i, unsigned j, unsigned Count) {
233
+ assert (i <= j && " Use moveLeft shift elements left" );
234
234
assert (j + Count <= N && " Invalid range" );
235
235
std::copy_backward (key + i, key + i + Count, key + j + Count);
236
236
std::copy_backward (val + i, val + i + Count, val + j + Count);
@@ -239,55 +239,57 @@ class NodeBase {
239
239
// / erase - Erase elements [i;j).
240
240
// / @param i Beginning of the range to erase.
241
241
// / @param j End of the range. (Exclusive).
242
- // / @param size Number of elements in node.
242
+ // / @param Size Number of elements in node.
243
243
void erase (unsigned i, unsigned j, unsigned Size) {
244
- lmove (j, i, Size - j);
244
+ moveLeft (j, i, Size - j);
245
245
}
246
246
247
247
// / shift - Shift elements [i;size) 1 position to the right.
248
248
// / @param i Beginning of the range to move.
249
- // / @param size Number of elements in node.
249
+ // / @param Size Number of elements in node.
250
250
void shift (unsigned i, unsigned Size) {
251
- rmove (i, i + 1 , Size - i);
251
+ moveRight (i, i + 1 , Size - i);
252
252
}
253
253
254
- // / xferLeft - Transfer elements to a left sibling node.
255
- // / @param size Number of elements in this.
256
- // / @param sib Left sibling node.
257
- // / @param ssize Number of elements in sib.
258
- // / @param count Number of elements to transfer.
259
- void xferLeft (unsigned Size, NodeBase &Sib, unsigned SSize, unsigned Count) {
254
+ // / transferToLeftSib - Transfer elements to a left sibling node.
255
+ // / @param Size Number of elements in this.
256
+ // / @param Sib Left sibling node.
257
+ // / @param SSize Number of elements in sib.
258
+ // / @param Count Number of elements to transfer.
259
+ void transferToLeftSib (unsigned Size, NodeBase &Sib, unsigned SSize,
260
+ unsigned Count) {
260
261
Sib.copy (*this , 0 , SSize, Count);
261
262
erase (0 , Count, Size);
262
263
}
263
264
264
- // / xferRight - Transfer elements to a right sibling node.
265
- // / @param size Number of elements in this.
266
- // / @param sib Right sibling node.
267
- // / @param ssize Number of elements in sib.
268
- // / @param count Number of elements to transfer.
269
- void xferRight (unsigned Size, NodeBase &Sib, unsigned SSize, unsigned Count) {
270
- Sib.rmove (0 , Count, SSize);
265
+ // / transferToRightSib - Transfer elements to a right sibling node.
266
+ // / @param Size Number of elements in this.
267
+ // / @param Sib Right sibling node.
268
+ // / @param SSize Number of elements in sib.
269
+ // / @param Count Number of elements to transfer.
270
+ void transferToRightSib (unsigned Size, NodeBase &Sib, unsigned SSize,
271
+ unsigned Count) {
272
+ Sib.moveRight (0 , Count, SSize);
271
273
Sib.copy (*this , Size-Count, 0 , Count);
272
274
}
273
275
274
- // / adjLeftSib - Adjust the number if elements in this node by moving
276
+ // / adjustFromLeftSib - Adjust the number if elements in this node by moving
275
277
// / elements to or from a left sibling node.
276
- // / @param size Number of elements in this.
277
- // / @param sib Right sibling node.
278
- // / @param ssize Number of elements in sib.
279
- // / @param add The number of elements to add to this node, possibly < 0.
278
+ // / @param Size Number of elements in this.
279
+ // / @param Sib Right sibling node.
280
+ // / @param SSize Number of elements in sib.
281
+ // / @param Add The number of elements to add to this node, possibly < 0.
280
282
// / @return Number of elements added to this node, possibly negative.
281
- int adjLeftSib (unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
283
+ int adjustFromLeftSib (unsigned Size, NodeBase &Sib, unsigned SSize, int Add) {
282
284
if (Add > 0 ) {
283
285
// We want to grow, copy from sib.
284
286
unsigned Count = std::min (std::min (unsigned (Add), SSize), N - Size);
285
- Sib.xferRight (SSize, *this , Size, Count);
287
+ Sib.transferToRightSib (SSize, *this , Size, Count);
286
288
return Count;
287
289
} else {
288
290
// We want to shrink, copy to sib.
289
291
unsigned Count = std::min (std::min (unsigned (-Add), Size), N - SSize);
290
- xferLeft (Size, Sib, SSize, Count);
292
+ transferToLeftSib (Size, Sib, SSize, Count);
291
293
return -Count;
292
294
}
293
295
}
@@ -463,7 +465,7 @@ class LeafNode : public NodeBase<std::pair<KeyT, KeyT>, ValT, N> {
463
465
464
466
// / findFrom - Find the first interval after i that may contain x.
465
467
// / @param i Starting index for the search.
466
- // / @param size Number of elements in node.
468
+ // / @param Size Number of elements in node.
467
469
// / @param x Key to search for.
468
470
// / @return First index with !stopLess(key[i].stop, x), or size.
469
471
// / This is the first interval that can possibly contain x.
@@ -519,7 +521,7 @@ class LeafNode : public NodeBase<std::pair<KeyT, KeyT>, ValT, N> {
519
521
// / possible. This may cause the node to grow by 1, or it may cause the node
520
522
// / to shrink because of coalescing.
521
523
// / @param i Starting index = insertFrom(0, size, a)
522
- // / @param size Number of elements in node.
524
+ // / @param Size Number of elements in node.
523
525
// / @param a Interval start.
524
526
// / @param b Interval stop.
525
527
// / @param y Value be mapped.
@@ -578,7 +580,7 @@ insertFrom(unsigned i, unsigned Size, KeyT a, KeyT b, ValT y) {
578
580
579
581
// / extendStop - Extend stop(i) to b, coalescing with following intervals.
580
582
// / @param i Interval to extend.
581
- // / @param size Number of elements in node.
583
+ // / @param Size Number of elements in node.
582
584
// / @param b New interval end point.
583
585
// / @return New node size after coalescing.
584
586
template <typename KeyT, typename ValT, unsigned N, typename Traits>
@@ -644,7 +646,7 @@ class BranchNode : public NodeBase<KeyT, NodeRef<KeyT, ValT, Traits>, N> {
644
646
645
647
// / findFrom - Find the first subtree after i that may contain x.
646
648
// / @param i Starting index for the search.
647
- // / @param size Number of elements in node.
649
+ // / @param Size Number of elements in node.
648
650
// / @param x Key to search for.
649
651
// / @return First index with !stopLess(key[i], x), or size.
650
652
// / This is the first subtree that can possibly contain x.
@@ -680,9 +682,9 @@ class BranchNode : public NodeBase<KeyT, NodeRef<KeyT, ValT, Traits>, N> {
680
682
681
683
// / insert - Insert a new (subtree, stop) pair.
682
684
// / @param i Insert position, following entries will be shifted.
683
- // / @param size Number of elements in node.
684
- // / @param node Subtree to insert.
685
- // / @param stp Last key in subtree.
685
+ // / @param Size Number of elements in node.
686
+ // / @param Node Subtree to insert.
687
+ // / @param Stop Last key in subtree.
686
688
void insert (unsigned i, unsigned Size, NodeRefT Node, KeyT Stop) {
687
689
assert (Size < N && " branch node overflow" );
688
690
assert (i <= Size && " Bad insert position" );
@@ -1647,7 +1649,7 @@ iterator::overflowLeaf() {
1647
1649
if (CurSize[n] == NewSize[n])
1648
1650
continue ;
1649
1651
for (int m = n - 1 ; m != -1 ; --m) {
1650
- int d = Node[n]->adjLeftSib (CurSize[n], *Node[m], CurSize[m],
1652
+ int d = Node[n]->adjustFromLeftSib (CurSize[n], *Node[m], CurSize[m],
1651
1653
NewSize[n] - CurSize[n]);
1652
1654
CurSize[m] -= d;
1653
1655
CurSize[n] += d;
@@ -1662,7 +1664,7 @@ iterator::overflowLeaf() {
1662
1664
if (CurSize[n] == NewSize[n])
1663
1665
continue ;
1664
1666
for (unsigned m = n + 1 ; m != Nodes; ++m) {
1665
- int d = Node[m]->adjLeftSib (CurSize[m], *Node[n], CurSize[n],
1667
+ int d = Node[m]->adjustFromLeftSib (CurSize[m], *Node[n], CurSize[n],
1666
1668
CurSize[n] - NewSize[n]);
1667
1669
CurSize[m] += d;
1668
1670
CurSize[n] -= d;
0 commit comments