//choose the best leaf node to insert the _entry, return the choosed leaf node's pointer. Recursion! VNode* VSTree::chooseNode(VNode* _p_node, const SigEntry& _entry) { if(_p_node->isLeaf()) { return _p_node; } else { int minDis = Signature::ENTITY_SIG_LENGTH + 1; //int maxDis = Signature::ENTITY_SIG_LENGTH + 1; int candidateIndex[VNode::MAX_CHILD_NUM]; int candidateNum = 0; int childNum = _p_node->getChildNum(); for(int i = 0; i < childNum; i++) { int curDis = _p_node->getChildEntry(i).xEpsilen(_entry); if(minDis >= curDis) { if(minDis > curDis) { minDis = curDis; candidateNum = 0; } candidateIndex[candidateNum++] = i; } } //NOTICE: the basic idea is to place similar signatures together?(the smaller num?) //BETTER: recursion is too costly , and the performance maybe not so good minDis = Signature::ENTITY_SIG_LENGTH + 1; //maxDis = Signature::ENTITY_SIG_LENGTH + 1; VNode* ret = NULL; for(int i = 0; i < candidateNum; i++) { int child_i = candidateIndex[i]; VNode* p_child = _p_node->getChild(child_i, *(this->node_buffer)); //Recursion VNode *candidateLeafPtr = this->chooseNode(p_child, _entry); int curDis = candidateLeafPtr->getEntry().xEpsilen(_entry); if(curDis == 0) { return candidateLeafPtr; } if(minDis > curDis) { minDis = curDis; ret = candidateLeafPtr; } } return ret; } }
/* choose the best leaf node to insert the _entry, * return the choosed leaf node's pointer. * Recursion function! */ VNode* VSTree::chooseNode(VNode* _p_node, const SigEntry& _entry) { if (_p_node->isLeaf()) { return _p_node; } else { int minDis = Signature::ENTITY_SIG_LENGTH + 1; int candidateIndex[VNode::MAX_CHILD_NUM]; int candidateNum = 0; int childNum = _p_node->getChildNum(); for (int i=0;i<childNum;i++) { int curDis = _p_node->getChildEntry(i).xEpsilen(_entry); if (minDis >= curDis) { if (minDis > curDis) { minDis = curDis; candidateNum = 0; } candidateIndex[candidateNum ++] = i; } } minDis = Signature::ENTITY_SIG_LENGTH + 1; VNode* ret = NULL; for (int i=0;i<candidateNum;i++) { int child_i = candidateIndex[i]; VNode* p_child = _p_node->getChild(child_i, *(this->node_buffer)); /* Recursion */ VNode *candidateLeafPtr = this->chooseNode(p_child, _entry); int curDis = candidateLeafPtr->getEntry().xEpsilen(_entry); if (curDis == 0) { return candidateLeafPtr; } if (minDis > curDis) { minDis = curDis; ret = candidateLeafPtr; } } return ret; } }
void VSTree::split(VNode* _p_node_being_split, const SigEntry& _insert_entry, VNode* _p_insert_node) { #ifdef DEBUG_VSTREE stringstream _ss; _ss << "**********************split happen at " << _p_node_being_split->getFileLine() << endl; _ss << _p_node_being_split->to_str() << endl; Util::logging(_ss.str()); #endif // first, add the new child node(if not leaf) or child entry(if leaf) to the full node. bool just_insert_entry = (_p_insert_node == NULL); if(just_insert_entry) { _p_node_being_split->addChildEntry(_insert_entry, true); } else { _p_node_being_split->addChildNode(_p_insert_node, true); } SigEntry entryA, entryB; //BETTER: use hanming, xor result or the vector included angle to guess the distince. //And then also use the farest two as seeds. // //two seeds to generate two new nodes. //seedA kernel: the SigEntry with the minimal count of signature. //seedB kernel: the SigEntry with the maximal count of signature. int maxCount = 0; // record the minimal signature count. int entryA_index = 0; // record the seedA kernel index. for(int i = 0; i < VNode::MAX_CHILD_NUM; i++) { int currentCount = (int) _p_node_being_split->getChildEntry(i).getSigCount(); if(maxCount < currentCount) { maxCount = currentCount; entryA_index = i; } } entryA = _p_node_being_split->getChildEntry(entryA_index); maxCount = 0; int entryB_index = 0; // record the seedB kernel index. for(int i = 0; i < VNode::MAX_CHILD_NUM; i++) { //NOTICE:I think xOR should be used here to choose the farest two int currentCount = entryA.xOR(_p_node_being_split->getChildEntry(i)); //int currentCount = entryA.xEpsilen(_p_node_being_split->getChildEntry(i)); if(i != entryA_index && maxCount <= currentCount) { maxCount = currentCount; entryB_index = i; } } entryB = _p_node_being_split->getChildEntry(entryB_index); // AEntryIndex: the entry index near seedA. // BEntryIndex: the entry index near seedB. std::vector<int> entryIndex_nearA, entryIndex_nearB; entryIndex_nearA.clear(); entryIndex_nearB.clear(); entryIndex_nearA.push_back(entryA_index); entryIndex_nearB.push_back(entryB_index); int nearA_max_size, nearB_max_size; bool nearA_tooSmall, nearB_tooSmall; for(int i = 0; i < VNode::MAX_CHILD_NUM; i++) { if(i == entryA_index || i == entryB_index) continue; //should guarantee that each new node has at least MIN_CHILD_NUM children. nearA_max_size = VNode::MAX_CHILD_NUM - entryIndex_nearB.size(); nearA_tooSmall = (nearA_max_size <= VNode::MIN_CHILD_NUM); if(nearA_tooSmall) { for(; i < VNode::MAX_CHILD_NUM; i++) { if (i == entryA_index || i == entryB_index) continue; entryIndex_nearA.push_back(i); } break; } nearB_max_size = VNode::MAX_CHILD_NUM - entryIndex_nearA.size(); nearB_tooSmall = (nearB_max_size <= VNode::MIN_CHILD_NUM); if(nearB_tooSmall) { for(; i < VNode::MAX_CHILD_NUM; i++) { if(i == entryA_index || i == entryB_index) continue; entryIndex_nearB.push_back(i); } break; } //calculate the distance from //the i-th child entry signature to seedA(or seedB). //NOTICE:we should expect that the candidate can be almost contained! //However, the precondition there are not too many 1s int disToSeedA = entryA.xEpsilen(_p_node_being_split->getChildEntry(i)); int disToSeedB = entryB.xEpsilen(_p_node_being_split->getChildEntry(i)); // choose the near one seed to add into if(disToSeedA <= disToSeedB) { entryIndex_nearA.push_back(i); } else { entryIndex_nearB.push_back(i); } } // then create a new node to act as BEntryIndex's father. VNode* newNodePtr = this->createNode(); #ifdef DEBUG_VSTREE stringstream _ss2; _ss2 << "new Node is :[" << newNodePtr->getFileLine() << "]" << endl; Util::logging(_ss2.str()); #endif // the old one acts as AEntryIndex's father. VNode* oldNodePtr = _p_node_being_split; // if the old node is leaf, set the new node as a leaf. if(oldNodePtr->isLeaf()) { newNodePtr->setAsLeaf(true); } //add all the entries in BEntryIndex into the new node child entry array, //and calculate the new node's entry. for(unsigned i = 0; i < entryIndex_nearB.size(); i++) { if(oldNodePtr->isLeaf()) { newNodePtr->addChildEntry(oldNodePtr->getChildEntry(entryIndex_nearB[i]), false); } else { //debug target 2 VNode* childPtr = oldNodePtr->getChild(entryIndex_nearB[i], *(this->node_buffer)); newNodePtr->addChildNode(childPtr); } } newNodePtr->refreshSignature(); //label the child being removed with -1, //and update the old node's entry. sort(entryIndex_nearA.begin(), entryIndex_nearA.end(), less<int>()); #ifdef DEBUG_VSTREE stringstream _ss1; { _ss1 << "nearA: "; for(unsigned i = 0; i < entryIndex_nearA.size(); i++) { _ss1 << entryIndex_nearA[i] << " "; } _ss1 << endl; _ss1 << "nearB: "; for(unsigned i = 0; i < entryIndex_nearB.size(); i++) { _ss1 << entryIndex_nearB[i] << " "; } _ss1 << endl; } Util::logging(_ss1.str()); #endif for(unsigned i = 0; i < entryIndex_nearA.size(); i++) { oldNodePtr->setChildEntry(i, oldNodePtr->getChildEntry(entryIndex_nearA[i])); oldNodePtr->setChildFileLine(i, oldNodePtr->getChildFileLine(entryIndex_nearA[i])); } oldNodePtr->setChildNum(entryIndex_nearA.size()); oldNodePtr->refreshSignature(); int oldNode_index = oldNodePtr->getIndexInFatherNode(*(this->node_buffer)); // full node's father pointer. VNode* oldNodeFatherPtr = oldNodePtr->getFather(*(this->node_buffer)); if(oldNodePtr->isRoot()) { //if the old node is root, //split the root, create a new root, //and the tree height will be increased. VNode* RootNewPtr = this->createNode(); //change the old root node to not-root node, //and set the RootNew to root node. oldNodePtr->setAsRoot(false); RootNewPtr->setAsRoot(true); //set the split two node(old node and new node) as the new root's child, //and update signatures. RootNewPtr->addChildNode(oldNodePtr); RootNewPtr->addChildNode(newNodePtr); RootNewPtr->refreshSignature(); //debug // { // stringstream _ss; // _ss << "create new root:" << endl; // _ss << "before swap file line, two sons are: " << oldNodePtr->getFileLine() << " " << newNodePtr->getFileLine() << endl; // Util::logging(_ss.str()); // } //should keep the root node always being //at the first line(line zero) of the tree node file. this->swapNodeFileLine(RootNewPtr, oldNodePtr); this->height++; //debug // { // stringstream _ss; // _ss << "create new root:" << endl; // _ss << "two sons are: " << oldNodePtr->getFileLine() << " " << newNodePtr->getFileLine() << endl; // _ss << Signature::BitSet2str(oldNodePtr->getEntry().getEntitySig().entityBitSet) << endl; // _ss << RootNewPtr->to_str() << endl; // Util::logging(_ss.str()); // } } else { //if the (OldNode) is not Root, //change the old node's signature to A's signature. oldNodeFatherPtr->setChildEntry(oldNode_index, oldNodePtr->getEntry()); if(oldNodeFatherPtr->isFull()) { oldNodeFatherPtr->refreshAncestorSignature(*(this->node_buffer)); this->split(oldNodeFatherPtr, newNodePtr->getEntry(), newNodePtr); } else { oldNodeFatherPtr->addChildNode(newNodePtr); oldNodeFatherPtr->refreshAncestorSignature(*(this->node_buffer)); } } //debug // if (!oldNodePtr->checkState()) // { // stringstream _ss; // _ss << "node " << oldNodePtr->getFileLine() << " childFileLine error. oldNode when split" << endl; // Util::logging(_ss.str()); // } // if (!newNodePtr->checkState()) // { // stringstream _ss; // _ss << "node " << newNodePtr->getFileLine() << " childFileLine error. newNode when split" << endl; // Util::logging(_ss.str()); // } // update the entityID2FileLineMap by these two nodes. this->updateEntityID2FileLineMap(oldNodePtr); this->updateEntityID2FileLineMap(newNodePtr); }
//the _entry_index in _child is to be removed. //node can only be deleted in this function. void VSTree::coalesce(VNode* _child, int _entry_index) { #ifdef DEBUG cout << "coalesce happen" <<endl; #endif //found the father and index VNode* _father = _child->getFather(*(this->node_buffer)); int cn = _child->getChildNum(); if(_father == NULL) //this is already root { //NOTICE:when root is leaf, at least one key, otherwise the tree is empty //But when root is internal, at least two key, if one key then shrink //(1-key internal root is not permitted) // //Notice that leaf-root case has been discussed in upper function removeEntry() //so here the root must be internal node _child->removeChild(_entry_index); if(cn == 2) { //only one key after remove, shrink root VNode* newRoot = _child->getChild(0, *(this->node_buffer)); newRoot->setAsRoot(true); cout<<"shrink root in coalesce() -- to swap node file"<<endl; this->swapNodeFileLine(newRoot, _child); this->root_file_line = newRoot->getFileLine(); this->height--; this->removeNode(_child); } return; } if(cn > VNode::MIN_CHILD_NUM) { cout<<"no need to move or union in coalesce()"<<endl; _child->removeChild(_entry_index); _child->refreshAncestorSignature(*(this->node_buffer)); return; } int fn = _father->getChildNum(); int i, _child_index = -1; for (i = 0; i < fn; ++i) { if (_father->getChildFileLine(i) == _child->getFileLine()) { break; } } if(i == fn) { cerr << "not found the leaf node in VSTree::coalesce()" << endl; return; } else { _child_index = i; } //_child->removeChild(_entry_index); //_child->setChildNum(cn); //NOTICE:we do not consider the efficiency here, so just ensure the operation is right //BETTER:find good way to ensure signatures are separated(maybe similar ones together) int ccase = 0; VNode* p = NULL; int n = 0; if(_child_index < fn - 1) { p = _father->getChild(_child_index+1, *(this->node_buffer)); n = p->getChildNum(); if(n > VNode::MIN_CHILD_NUM) { ccase = 2; } else { ccase = 1; } } if(_child_index > 0) { VNode* tp = _father->getChild(_child_index-1, *(this->node_buffer)); int tn = tp->getChildNum(); if(ccase < 2) { if(ccase == 0) ccase = 3; if(tn > VNode::MIN_CHILD_NUM) ccase = 4; } if(ccase > 2) { p = tp; n = tn; } } VNode* tmp = NULL; int child_no = _child->getFileLine(); int father_no = _father->getFileLine(); #ifdef DEBUG if(ccase == 1 || ccase == 3) { cout << "union happened" << endl; } else if(ccase == 2 || ccase == 4) { cout << "move happened" << endl; } cout<< "father num: "<<fn<<" child num: "<<cn<<" neighbor num: "<<n<<endl; cout<<"child file line "<<child_no<<endl; cout<<"neighbor file line "<<p->getFileLine()<<endl; #endif switch(ccase) { case 1: //union right to this if(_child->isLeaf()) { _child->setChildFileLine(_entry_index, p->getChildFileLine(0)); _child->setChildEntry(_entry_index, p->getChildEntry(0)); for(int i = 1; i < n; ++i) { _child->setChildFileLine(cn+i-1, p->getChildFileLine(i)); _child->addChildEntry(p->getChildEntry(i)); } } else { _child->setChildFileLine(_entry_index, p->getChildFileLine(0)); _child->setChildEntry(_entry_index, p->getChildEntry(0)); tmp = p->getChild(0, *(this->node_buffer)); tmp->setFatherFileLine(child_no); for(int i = 1; i < n; ++i) { tmp = p->getChild(i, *(this->node_buffer)); //cout<<i<<" "<<_child->getChildNum()<<endl; _child->addChildNode(tmp); //_child->setChildNum(cn+i); //tmp->setFatherFileLine(child_no); } } this->removeNode(p); _child->refreshSignature(); //recursive:to remove child index+1 in father this->coalesce(_father, _child_index+1); break; case 2: //move one from right _child->setChildFileLine(_entry_index, p->getChildFileLine(n-1)); _child->setChildEntry(_entry_index, p->getChildEntry(n-1)); _child->refreshSignature(); if(!_child->isLeaf()) { tmp = p->getChild(n-1, *(this->node_buffer)); tmp->setFatherFileLine(child_no); } p->removeChild(n-1); p->refreshSignature(); _father->setChildEntry(_child_index, _child->getEntry()); _father->setChildEntry(_child_index+1, p->getEntry()); _father->refreshAncestorSignature(*(this->node_buffer)); break; case 3: //union left to this if(_child->isLeaf()) { _child->setChildFileLine(_entry_index, p->getChildFileLine(0)); _child->setChildEntry(_entry_index, p->getChildEntry(0)); for(int i = 1; i < n; ++i) { _child->setChildFileLine(cn+i-1, p->getChildFileLine(i)); _child->addChildEntry(p->getChildEntry(i)); } } else { _child->setChildFileLine(_entry_index, p->getChildFileLine(0)); _child->setChildEntry(_entry_index, p->getChildEntry(0)); tmp = p->getChild(0, *(this->node_buffer)); tmp->setFatherFileLine(child_no); for(int i = 1; i < n; ++i) { tmp = p->getChild(i, *(this->node_buffer)); //cout<<i<<" "<<_child->getChildNum()<<endl; _child->addChildNode(tmp); //_child->setChildNum(cn+i); //tmp->setFatherFileLine(child_no); } } this->removeNode(p); _child->refreshSignature(); //recursive:to remove child index-1 in father this->coalesce(_father, _child_index-1); break; case 4: //move one from left _child->setChildFileLine(_entry_index, p->getChildFileLine(n-1)); _child->setChildEntry(_entry_index, p->getChildEntry(n-1)); _child->refreshSignature(); if(!_child->isLeaf()) { VNode* tmp = p->getChild(n-1, *(this->node_buffer)); tmp->setFatherFileLine(child_no); } p->removeChild(n-1); p->refreshSignature(); _father->setChildEntry(_child_index, _child->getEntry()); _father->setChildEntry(_child_index-1, p->getEntry()); _father->refreshAncestorSignature(*(this->node_buffer)); break; default: cout << "error in coalesce: Invalid case!"; break; } //BETTER:this maybe very costly because many entity no need to update if(_child->isLeaf()) { this->updateEntityID2FileLineMap(_child); if(ccase == 2 || ccase == 4) { this->updateEntityID2FileLineMap(p); } } }
void VSTree::split(VNode* _p_node_being_split, const SigEntry& _insert_entry, VNode* _p_insert_node) { //debug // { // stringstream _ss; // _ss << "**********************split happen at " // << _p_node_being_split->getFileLine() << endl; // _ss << _p_node_being_split->to_str() << endl; // Util::logging(_ss.str()); // } // first, add the new child node(if not leaf) or child entry(if leaf) to the full node. bool just_insert_entry = (_p_insert_node == NULL); if (just_insert_entry) { _p_node_being_split->addChildEntry(_insert_entry, true); } else { _p_node_being_split->addChildNode(_p_insert_node, true); } SigEntry entryA, entryB; /* two seeds to generate two new nodes. * seedA kernel: the SigEntry with the minimal count of signature. * seedB kernel: the SigEntry with the second minimal count of signature. * */ int minCount = 0; // record the minimal signature count. int entryA_index = 0; // record the seedA kernel index. for (int i=0;i<VNode::MAX_CHILD_NUM;i++) { int currentCount = (int) _p_node_being_split->getChildEntry(i).getSigCount(); if (minCount < currentCount) { minCount = currentCount; entryA_index = i; } } entryA = _p_node_being_split->getChildEntry(entryA_index); minCount = 0; int entryB_index = 0; // record the seedB kernel index. for (int i=0;i<VNode::MAX_CHILD_NUM;i++) { int currentCount = entryA.xEpsilen(_p_node_being_split->getChildEntry(i)); if (i != entryA_index && minCount <= currentCount) { minCount = currentCount; entryB_index = i; } } entryB = _p_node_being_split->getChildEntry(entryB_index); // AEntryIndex: the entry index near seedA. // BEntryIndex: the entry index near seedB. std::vector<int> entryIndex_nearA, entryIndex_nearB; entryIndex_nearA.clear(); entryIndex_nearB.clear(); entryIndex_nearA.push_back(entryA_index); entryIndex_nearB.push_back(entryB_index); /* just tmp variables, for more readibility */ int nearA_max_size, nearB_max_size; bool nearA_tooSmall, nearB_tooSmall; for (int i=0;i<VNode::MAX_CHILD_NUM;i++) { if (i == entryA_index || i == entryB_index) continue; /* should guarantee that each new node has at least MIN_CHILD_NUM children. */ nearA_max_size = VNode::MAX_CHILD_NUM - entryIndex_nearB.size(); nearA_tooSmall = (nearA_max_size <= VNode::MIN_CHILD_NUM); if (nearA_tooSmall) { for (;i<VNode::MAX_CHILD_NUM;i++) { if (i == entryA_index || i == entryB_index) continue; entryIndex_nearA.push_back(i); } break; } nearB_max_size = VNode::MAX_CHILD_NUM - entryIndex_nearA.size(); nearB_tooSmall = (nearB_max_size <= VNode::MIN_CHILD_NUM); if (nearB_tooSmall) { for (;i<VNode::MAX_CHILD_NUM;i++) { if (i == entryA_index || i == entryB_index) continue; entryIndex_nearB.push_back(i); } break; } /* calculate the distance from * the i-th child entry signature to seedA(or seedB).*/ /*debug target 1*/ int disToSeedA = entryA.xEpsilen(_p_node_being_split->getChildEntry(i)); int disToSeedB = entryB.xEpsilen(_p_node_being_split->getChildEntry(i)); // choose the near one seed to add into if (disToSeedA <= disToSeedB) { entryIndex_nearA.push_back(i); } else { entryIndex_nearB.push_back(i); } } // then create a new node to act as BEntryIndex's father. VNode* newNodePtr = this->createNode(); //debug // { // stringstream _ss; // _ss << "new Node is :[" << newNodePtr->getFileLine() << "]" << endl; // Util::logging(_ss.str()); // } // the old one acts as AEntryIndex's father. VNode* oldNodePtr = _p_node_being_split; // if the old node is leaf, set the new node as a leaf. if (oldNodePtr->isLeaf()) { newNodePtr->setAsLeaf(true); } /* add all the entries in BEntryIndex into the new node child entry array, and calculate the new node's entry.*/ for (unsigned i=0;i<entryIndex_nearB.size();i++) { if (oldNodePtr->isLeaf()) { newNodePtr->addChildEntry(oldNodePtr->getChildEntry(entryIndex_nearB[i]), false); } else { /*debug target 2*/ VNode* childPtr = oldNodePtr->getChild(entryIndex_nearB[i], *(this->node_buffer)); newNodePtr->addChildNode(childPtr); } } newNodePtr->refreshSignature(); /* label the child being removed with -1, * and update the old node's entry.*/ std::sort(entryIndex_nearA.begin(), entryIndex_nearA.end(), less<int>()); //debug // { // stringstream _ss; // { // _ss << "nearA: "; // for(int i = 0; i < entryIndex_nearA.size(); i ++) // { // _ss << entryIndex_nearA[i] << " "; // } // _ss << endl; // // _ss << "nearB: "; // for(int i = 0; i < entryIndex_nearB.size(); i ++) // { // _ss << entryIndex_nearB[i] << " "; // } // _ss << endl; // } // Util::logging(_ss.str()); // } for (unsigned i=0;i<entryIndex_nearA.size();i++) { oldNodePtr->setChildEntry(i, oldNodePtr->getChildEntry(entryIndex_nearA[i])); oldNodePtr->setChildFileLine(i, oldNodePtr->getChildFileLine(entryIndex_nearA[i])); } oldNodePtr->setChildNum(entryIndex_nearA.size()); oldNodePtr->refreshSignature(); int oldNode_index = oldNodePtr->getIndexInFatherNode(*(this->node_buffer)); // full node's father pointer. VNode* oldNodeFatherPtr = oldNodePtr->getFather(*(this->node_buffer)); if (oldNodePtr->isRoot()) { /* if the old node is root, * split the root, create a new root, * and the tree height will be increased.*/ VNode* RootNewPtr = this->createNode(); /* change the old root node to not-root node, * and set the RootNew to root node.*/ oldNodePtr->setAsRoot(false); RootNewPtr->setAsRoot(true); /* set the split two node(old node and new node) as the new root's child, * and update signatures.*/ RootNewPtr->addChildNode(oldNodePtr); RootNewPtr->addChildNode(newNodePtr); RootNewPtr->refreshSignature(); //debug // { // stringstream _ss; // _ss << "create new root:" << endl; // _ss << "before swap file line, two sons are: " << oldNodePtr->getFileLine() << " " << newNodePtr->getFileLine() << endl; // Util::logging(_ss.str()); // } /* should keep the root node always being * at the first line(line zero) of the tree node file.*/ this->swapNodeFileLine(RootNewPtr, oldNodePtr); this->height ++; //debug // { // stringstream _ss; // _ss << "create new root:" << endl; // _ss << "two sons are: " << oldNodePtr->getFileLine() << " " << newNodePtr->getFileLine() << endl; // _ss << Signature::BitSet2str(oldNodePtr->getEntry().getEntitySig().entityBitSet) << endl; // _ss << RootNewPtr->to_str() << endl; // Util::logging(_ss.str()); // } } else { /* if the (OldNode) is not Root, * change the old node's signature to A's signature.*/ oldNodeFatherPtr->setChildEntry(oldNode_index, oldNodePtr->getEntry()); if (oldNodeFatherPtr->isFull()) { oldNodeFatherPtr->refreshAncestorSignature(*(this->node_buffer)); this->split(oldNodeFatherPtr, newNodePtr->getEntry(), newNodePtr); } else { oldNodeFatherPtr->addChildNode(newNodePtr); oldNodeFatherPtr->refreshAncestorSignature(*(this->node_buffer)); } } //debug // if (!oldNodePtr->checkState()) // { // stringstream _ss; // _ss << "node " << oldNodePtr->getFileLine() << " childFileLine error. oldNode when split" << endl; // Util::logging(_ss.str()); // } // if (!newNodePtr->checkState()) // { // stringstream _ss; // _ss << "node " << newNodePtr->getFileLine() << " childFileLine error. newNode when split" << endl; // Util::logging(_ss.str()); // } // update the entityID2FileLineMap by these two nodes. this->updateEntityID2FileLineMap(oldNodePtr); this->updateEntityID2FileLineMap(newNodePtr); }