Lines Matching defs:top

54     static LocHeapNode* pop(LocHeapNode*& top);
59 static LocHeapNode* remove(LocHeapNode*& top, LocRankable& data);
104 // mData of tree top ranks lower than that of the incoming node,
127 // the tree. It recursively swaps with the higher ranked top of the
130 // swapped all the way down from the top. The pinter to the tree and
134 LocHeapNode* LocHeapNode::pop(LocHeapNode*& top) {
135 // we know the top has the highest ranking at this point, else
136 // the tree is broken. This top will be popped out. But we need
138 // to replace the current top. This then will need to be done
140 // current top node all the way down to the leaf level.
141 LocHeapNode* poppedNode = top;
142 // top is losing a node in its subtree
143 top->mSize--;
144 if (top->mLeft || top->mRight) {
148 LocHeapNode*& subTop = (NULL == top->mLeft) ? top->mRight :
149 ((NULL == top->mRight) ? top->mLeft :
150 (top->mLeft->outRanks(*(top->mRight)) ? top->mLeft : top->mRight));
151 // swap mData, the tree top gets updated with the new data.
152 top->swap(*subTop);
156 // if the top has only single node
160 top = NULL;
170 LocHeapNode* LocHeapNode::remove(LocHeapNode*& top, LocRankable& data) {
173 if (&data == (LocRankable*)(top->mData)) {
175 removedNode = pop(top);
176 } else if (!data.outRanks(*top->mData)) {
178 if (top->mLeft) {
179 removedNode = remove(top->mLeft, data);
182 if (!removedNode && top->mRight) {
183 removedNode = remove(top->mRight, data);
186 // top lost a node in its subtree
188 top->mSize--;
238 LocRankable* top = NULL;
240 top = mTree->mData;
242 return top;