本文整理汇总了C++中GiSTnode::IsLeaf方法的典型用法代码示例。如果您正苦于以下问题:C++ GiSTnode::IsLeaf方法的具体用法?C++ GiSTnode::IsLeaf怎么用?C++ GiSTnode::IsLeaf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GiSTnode
的用法示例。
在下文中一共展示了GiSTnode::IsLeaf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadNode
void
MT::CollectStats ()
{
GiSTpath path;
path.MakeRoot ();
GiSTnode *node = ReadNode (path);
if (!node->IsLeaf()) {
int maxLevel = node->Level();
double *radii = new double[maxLevel];
int *pages = new int[maxLevel];
for (int i=0; i<maxLevel; i++) {
pages[i] = 0;
radii[i] = 0;
}
TruePredicate truePredicate;
GiSTlist<GiSTentry*> list = node->Search(truePredicate); // retrieve all the entries in this node
double overlap = ((MTnode *)node)->Overlap();
double totalOverlap = overlap;
delete node;
while (!list.IsEmpty()) {
GiSTentry *entry = list.RemoveFront ();
path.MakeChild (entry->Ptr());
node = ReadNode (path);
overlap = ((MTnode *)node)->Overlap();
totalOverlap += overlap;
pages[node->Level()]++;
radii[node->Level()] += ((MTkey *) entry->Key())->MaxRadius();
GiSTlist<GiSTentry*> newlist;
if (!node->IsLeaf()) {
newlist = node->Search(truePredicate); // recurse to next level
}
while (!newlist.IsEmpty()) {
list.Append (newlist.RemoveFront ());
}
path.MakeParent ();
delete entry;
delete node;
}
// output the results
cout << "Level:\tPages:\tAverage_Radius:"<<endl;
int totalPages = 1; // for the root
for (int i=maxLevel-1; i>=0; i--) {
totalPages += pages[i];
cout << i << ":\t" << pages[i] << "\t" << radii[i]/pages[i] << endl;
}
cout << "TotalPages:\t" << totalPages << endl;
cout << "LeafPages:\t" << pages[0] << endl;
cout << "TotalOverlap:\t" << (float)totalOverlap << endl;
delete []radii;
delete []pages;
} else {
delete node;
}
}
示例2:
GiSTnode*
GiST::ChooseSubtree(GiSTpage page, const GiSTentry &entry, int level)
{
GiSTnode *node;
GiSTpath path;
for(;;) {
path.MakeChild(page);
node=ReadNode(path);
if(level==node->Level()||node->IsLeaf()) break;
page=node->SearchMinPenalty(entry);
delete node;
}
return node;
}
示例3: ReadNode
void
GiST::DumpNode (ostream& os, GiSTpath path) const
{
GiSTnode *node = ReadNode(path);
node->Print(os);
if (!node->IsLeaf()) {
TruePredicate truePredicate;
GiSTlist<GiSTentry*> list = node->Search(truePredicate);
while (!list.IsEmpty()) {
GiSTentry *e = list.RemoveFront();
path.MakeChild(e->Ptr());
DumpNode (os, path);
path.MakeParent();
delete e;
}
}
delete node;
}