本文整理汇总了C++中GiSTnode::Sibling方法的典型用法代码示例。如果您正苦于以下问题:C++ GiSTnode::Sibling方法的具体用法?C++ GiSTnode::Sibling怎么用?C++ GiSTnode::Sibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GiSTnode
的用法示例。
在下文中一共展示了GiSTnode::Sibling方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// handle underfull leaf nodes
int
GiST::CondenseTree(GiSTnode *node)
{
GiSTlist<GiSTentry*> Q;
int deleted=0;
// Must be condensing a leaf
assert(node->IsLeaf());
while(!node->Path().IsRoot()) {
GiSTpath parent_path=node->Path();
parent_path.MakeParent();
GiSTnode *P=ReadNode(parent_path);
GiSTentry *En=P->SearchPtr(node->Path().Page());
assert(En!=NULL);
// Handle under-full node
if(node->IsUnderFull(*store)) {
if(!IsOrdered()) {
TruePredicate truePredicate;
GiSTlist<GiSTentry*> list=node->Search(truePredicate);
while(!list.IsEmpty()) {
GiSTentry *e=list.RemoveFront();
Q.Append(e);
}
P->DeleteEntry(En->Position());
WriteNode(P);
deleted=1;
AdjustKeys(P, NULL);
}
else {
// Try to borrow entries, else coalesce with a neighbor
// Have to look at left sibling???
GiSTpage neighbor_page=P->SearchNeighbors(node->Path().Page());
GiSTpath neighbor_path=node->Path();
neighbor_path.MakeSibling(neighbor_page);
if(neighbor_page!=0) {
GiSTnode *neighbor;
// If neighbor is RIGHT sibling...
if(node->Sibling()==neighbor_page) neighbor=ReadNode(neighbor_path);
else {
neighbor=node;
node=ReadNode(neighbor_path);
}
GiSTentry *e=P->SearchPtr(node->Path().Page());
node->Coalesce(*neighbor, *e);
delete e;
// If not overfull, coalesce, kill right node
if(!node->IsOverFull(*store)) {
node->SetSibling(neighbor->Sibling());
WriteNode(node);
// Delete the neighbor from parent
GiSTentry *e=P->SearchPtr(neighbor->Path().Page());
P->DeleteEntry(e->Position());
WriteNode(P);
delete e;
store->Deallocate(neighbor->Path().Page());
deleted=1;
}
// If overfull, split (same as borrowing)
else {
GiSTnode *node2=node->PickSplit();
node2->Path()=neighbor->Path();
node2->SetSibling(neighbor->Sibling());
WriteNode(node);
WriteNode(node2);
AdjustKeys(node2, &P);
delete node2;
deleted=1;
}
delete neighbor;
}
}
}
// Adjust covering predicate
if(!deleted) AdjustKeys(node, &P);
parent_path=node->Path();
parent_path.MakeParent();
delete node;
// Propagate deletes
if(!deleted) break;
node=P;
}
// Re-insert orphaned entries
while(!Q.IsEmpty()) {
GiSTentry *e=Q.RemoveFront();
InsertHelper(*e, e->Level());
delete e;
}
return(deleted);
//.........这里部分代码省略.........