Skip to content

Commit 8e0cc61

Browse files
committed
Rename methods for clarity instead of brevity. No functional changes.
llvm-svn: 119820
1 parent 88ff56c commit 8e0cc61

File tree

1 file changed

+46
-44
lines changed

1 file changed

+46
-44
lines changed

llvm/include/llvm/ADT/IntervalMap.h

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ class NodeBase {
203203
VT val[N];
204204

205205
/// copy - Copy elements from another node.
206-
/// @param other Node elements are copied from.
206+
/// @param Other Node elements are copied from.
207207
/// @param i Beginning of the source range in other.
208208
/// @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.
210210
template <unsigned M>
211211
void copy(const NodeBase<KT, VT, M> &Other, unsigned i,
212212
unsigned j, unsigned Count) {
@@ -216,21 +216,21 @@ class NodeBase {
216216
std::copy(Other.val + i, Other.val + i + Count, val + j);
217217
}
218218

219-
/// lmove - Move elements to the left.
219+
/// moveLeft - Move elements to the left.
220220
/// @param i Beginning of the source range.
221221
/// @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");
225225
copy(*this, i, j, Count);
226226
}
227227

228-
/// rmove - Move elements to the right.
228+
/// moveRight - Move elements to the right.
229229
/// @param i Beginning of the source range.
230230
/// @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");
234234
assert(j + Count <= N && "Invalid range");
235235
std::copy_backward(key + i, key + i + Count, key + j + Count);
236236
std::copy_backward(val + i, val + i + Count, val + j + Count);
@@ -239,55 +239,57 @@ class NodeBase {
239239
/// erase - Erase elements [i;j).
240240
/// @param i Beginning of the range to erase.
241241
/// @param j End of the range. (Exclusive).
242-
/// @param size Number of elements in node.
242+
/// @param Size Number of elements in node.
243243
void erase(unsigned i, unsigned j, unsigned Size) {
244-
lmove(j, i, Size - j);
244+
moveLeft(j, i, Size - j);
245245
}
246246

247247
/// shift - Shift elements [i;size) 1 position to the right.
248248
/// @param i Beginning of the range to move.
249-
/// @param size Number of elements in node.
249+
/// @param Size Number of elements in node.
250250
void shift(unsigned i, unsigned Size) {
251-
rmove(i, i + 1, Size - i);
251+
moveRight(i, i + 1, Size - i);
252252
}
253253

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) {
260261
Sib.copy(*this, 0, SSize, Count);
261262
erase(0, Count, Size);
262263
}
263264

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);
271273
Sib.copy(*this, Size-Count, 0, Count);
272274
}
273275

274-
/// adjLeftSib - Adjust the number if elements in this node by moving
276+
/// adjustFromLeftSib - Adjust the number if elements in this node by moving
275277
/// 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.
280282
/// @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) {
282284
if (Add > 0) {
283285
// We want to grow, copy from sib.
284286
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);
286288
return Count;
287289
} else {
288290
// We want to shrink, copy to sib.
289291
unsigned Count = std::min(std::min(unsigned(-Add), Size), N - SSize);
290-
xferLeft(Size, Sib, SSize, Count);
292+
transferToLeftSib(Size, Sib, SSize, Count);
291293
return -Count;
292294
}
293295
}
@@ -463,7 +465,7 @@ class LeafNode : public NodeBase<std::pair<KeyT, KeyT>, ValT, N> {
463465

464466
/// findFrom - Find the first interval after i that may contain x.
465467
/// @param i Starting index for the search.
466-
/// @param size Number of elements in node.
468+
/// @param Size Number of elements in node.
467469
/// @param x Key to search for.
468470
/// @return First index with !stopLess(key[i].stop, x), or size.
469471
/// This is the first interval that can possibly contain x.
@@ -519,7 +521,7 @@ class LeafNode : public NodeBase<std::pair<KeyT, KeyT>, ValT, N> {
519521
/// possible. This may cause the node to grow by 1, or it may cause the node
520522
/// to shrink because of coalescing.
521523
/// @param i Starting index = insertFrom(0, size, a)
522-
/// @param size Number of elements in node.
524+
/// @param Size Number of elements in node.
523525
/// @param a Interval start.
524526
/// @param b Interval stop.
525527
/// @param y Value be mapped.
@@ -578,7 +580,7 @@ insertFrom(unsigned i, unsigned Size, KeyT a, KeyT b, ValT y) {
578580

579581
/// extendStop - Extend stop(i) to b, coalescing with following intervals.
580582
/// @param i Interval to extend.
581-
/// @param size Number of elements in node.
583+
/// @param Size Number of elements in node.
582584
/// @param b New interval end point.
583585
/// @return New node size after coalescing.
584586
template <typename KeyT, typename ValT, unsigned N, typename Traits>
@@ -644,7 +646,7 @@ class BranchNode : public NodeBase<KeyT, NodeRef<KeyT, ValT, Traits>, N> {
644646

645647
/// findFrom - Find the first subtree after i that may contain x.
646648
/// @param i Starting index for the search.
647-
/// @param size Number of elements in node.
649+
/// @param Size Number of elements in node.
648650
/// @param x Key to search for.
649651
/// @return First index with !stopLess(key[i], x), or size.
650652
/// This is the first subtree that can possibly contain x.
@@ -680,9 +682,9 @@ class BranchNode : public NodeBase<KeyT, NodeRef<KeyT, ValT, Traits>, N> {
680682

681683
/// insert - Insert a new (subtree, stop) pair.
682684
/// @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.
686688
void insert(unsigned i, unsigned Size, NodeRefT Node, KeyT Stop) {
687689
assert(Size < N && "branch node overflow");
688690
assert(i <= Size && "Bad insert position");
@@ -1647,7 +1649,7 @@ iterator::overflowLeaf() {
16471649
if (CurSize[n] == NewSize[n])
16481650
continue;
16491651
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],
16511653
NewSize[n] - CurSize[n]);
16521654
CurSize[m] -= d;
16531655
CurSize[n] += d;
@@ -1662,7 +1664,7 @@ iterator::overflowLeaf() {
16621664
if (CurSize[n] == NewSize[n])
16631665
continue;
16641666
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],
16661668
CurSize[n] - NewSize[n]);
16671669
CurSize[m] += d;
16681670
CurSize[n] -= d;

0 commit comments

Comments
 (0)