亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? tvnode.c

?? TV-tree的c實現源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*                    COPYRIGHT NOTICE This material was developed by Christos Faloutsos and King-Ip Linat the University of Maryland, College Park, Department of Computer Science.Permission is granted to copy this software, to redistribute iton a nonprofit basis, and to use it for any purpose, subject tothe following restrictions and understandings. 1. Any copy made of this software must include this copyright noticein full. 2. All materials developed as a consequence of the use of thissoftware shall duly acknowledge such use, in accordance with the usualstandards of acknowledging credit in academic research. 3. The authors have made no warranty or representation that theoperation of this software will be error-free or suitable for anyapplication, and they are under under no obligation to provide anyservices, by way of maintenance, update, or otherwise.  The softwareis an experimental prototype offered on an as-is basis. 4. Redistribution for profit requires the express, written permissionof the authors. */// Author : $Author$// Date : $Date$// Id : $Id$// $Id: node.C,v 1.3 1996/04/18 21:50:24 kilin Exp kilin $ // Please change sig_dim to active_dim#include <iostream.h>#include <assert.h>#include <stdlib.h>#include <fstream.h>#include "TVdefine.h"#include "TVconstants.h"#include "TVvector.h"#include "TVrectangle.h"//#include "TVrectangle.h"#include "TVelement.h"#include "TVsimbuf.h"#include "TVnode.h"#include "TVutil.h"#include "TVsplit.h"#include "TVreinsert.h"extern Storage *globstorage;TVNodehandle::TVNodehandle(){   ptr = NULL;   pagenum = -1;}TVNodehandle::TVNodehandle(Internal_TVNode& n){  ptr = (TVNode *)&n;  pagenum = globstorage->newpage();}TVNodehandle::TVNodehandle(TVNode* n){  ptr = n;  pagenum = globstorage->newpage();}TVNodehandle::TVNodehandle(Leaf_TVNode& n){  ptr = (TVNode *)&n;  pagenum = globstorage->newpage();}TVNodehandle::TVNodehandle(const TVNodehandle& nh){  ptr = nh.ptr;  pagenum = nh.pagenum;}TVNodehandle& TVNodehandle::operator=(const TVNodehandle& nh){  ptr = nh.ptr;  pagenum = nh.pagenum;  return *this;}// return the size of the handle (not the node)// Assume all pointer have the same sizeint TVNodehandle::bytes() const{   return sizeof(TVNode *);}TVNode* TVNodehandle::fetch() const{   globstorage->fetch(pagenum);   return ptr;}// return FALSE when write failint TVNodehandle::write() const{   if (pagenum > -1)      globstorage->writepage(pagenum);   return TRUE;}TVNodehandle& TVNodehandle::assign(Internal_TVNode& n){   ptr = (TVNode *)&n;   pagenum = globstorage->newpage();   return *this;}TVNodehandle& TVNodehandle::assign(Leaf_TVNode& d){   ptr = (TVNode *)&d;   pagenum = globstorage->newpage();   return *this;}TVNodehandle& TVNodehandle::assign(TVNode* d){   ptr = d;   pagenum = globstorage->newpage();   return *this;}int TVNodehandle::null() const{   return !ptr;}TVNodehandle& TVNodehandle::setnull(){  ptr = NULL;  if (pagenum > 0)     {       globstorage->clearpage(pagenum);       pagenum = -1;     }  return *this;}void TVNodehandle::clearpage(){  globstorage->clearpage(pagenum);}ostream& operator<<(ostream& os, const TVNodehandle& nh){   if (nh.ptr)      os <<  "TVNode ptr : " << nh.ptr;   os << "  Page number : " << nh.pagenum;   return os;}TVNode::TVNode(){   count = 0;   max_count = 0;}TVNode::TVNode(int maxc){   count = 0;   max_count = maxc;}TVNode::TVNode(const TVNode &n){   count = n.count;   max_count = n.max_count;}TVNode::~TVNode(){}TVNode& TVNode::operator=(const TVNode& n){   count = n.count;   max_count = n.max_count;   return *this;}int TVNode::MaxCount(){   return max_count;}int TVNode::GetCount(){   return count;}void TVNode::WriteToDisk(){  // increase statistics}Internal_TVNode::Internal_TVNode(){   level = -1;   entry = NULL;}Internal_TVNode::Internal_TVNode(int l, int maxc) : TVNode(maxc){   level = l;   entry = NULL;   entry = new TVBranch[maxc];}Internal_TVNode::Internal_TVNode(const Internal_TVNode &n){   count = n.count;   max_count = n.max_count;   level = n.level;   entry = new TVBranch[n.max_count];   for (int i = 0; i < n.count; i++)     entry[i] = n.entry[i];}Internal_TVNode::~Internal_TVNode(){   if (max_count > 0)      {         for (int j = 0; j < count ; j++)             entry[j].TVBranch::~TVBranch();         delete [] entry;      }}Internal_TVNode& Internal_TVNode::Reinit(){   if (max_count > 0)      {         for (int j = 0; j < count ; j++)             entry[j].TVBranch::~TVBranch();         delete [] entry;      }   entry = new TVBranch[max_count];   count = 0;   return *this;}Internal_TVNode& Internal_TVNode::operator=(const Internal_TVNode& n){   if (max_count > 0)      {         for (int j = 0; j < count ; j++)             entry[j].TVBranch::~TVBranch();         delete [] entry;      }   count = n.count;   max_count = n.max_count;   level = n.level;   entry = new TVBranch[n.max_count];   for (int i = 0; i < n.count; i++)     entry[i] = n.entry[i];   return *this;}int Internal_TVNode::TVNodeType() const{  return INTERNAL_NODE;}int Internal_TVNode::Size() const{  int bsize=0;  for (int i=0; i < count; i++)      bsize += entry[i].Size();  return sizeof(count) + sizeof(max_count) + sizeof(level) + bsize;}int Internal_TVNode::GetLevel(){  return level;}int Internal_TVNode::ParentOfLeaf(){   return level == PARENT_OF_LEAF;}TVNodeEntry Internal_TVNode::Fetch(int i) const{  assert (i < max_count);  TVNodeEntry f(entry[i]);  return f;}int Internal_TVNode::Put(const TVBranch& b, int pagesize){   int result;// cout << "B.size, Size : " << b.Size() << ", " << Size() << "\n";   if (b.Size() + Size() <= pagesize)      {         if (count >= max_count)            {               // current array not big enough, create new one               TVBranch *newentry = new TVBranch[max_count * 2];               max_count = max_count * 2;               for (int i = 0; i < count ; i++)                   newentry[i] = entry[i];               newentry[count++] = b;               delete [] entry;               entry = newentry;            }         else            {              entry[count++] = b;              result = NODE_NOT_FULL;            }      }   else      result = NODE_FULL;   return result;}int Internal_TVNode::Remove(int bno, float min_fill_percent){   assert((bno < count) && (bno >= 0));   assert(min_fill_percent > 0);   entry[bno] = entry[count - 1];   if (--(count) < min_fill_percent * max_count / 100.0)      return(NODE_EMPTY);   else      return(NODE_NOT_EMPTY);}TVRectangle Internal_TVNode::MinBound(int sig_dim){   TVRectangle *darray = new TVRectangle[count];   for (int i = 0; i < count; i++)       darray[i] = entry[i].GetBound();   delete [] darray;   return (MinBoundTVRectangle(darray, count, sig_dim));}int Internal_TVNode::FixSize(){   return sizeof(int) * 3;}// Redistribute the nodes from the split return entriesInternal_TVNode& Internal_TVNode::ReDistribute(SplitReturn& sret, TVBranch *barray, int pagesize){  Reinit();    if (sret.newnode)    delete [] sret.newnode;  if (sret.parts > 1)     sret.newnode = new TVNode*[sret.parts - 1];  for (int i = 0; i < sret.parts - 1; i++)     sret.newnode[i] = new Internal_TVNode(level, max(max_count, CONSERVE_MAX_BRANCH_FACTOR));  for (int j = 0; j < sret.entrycount; j++)     {	if (sret.distribute[j])	    sret.newnode[sret.distribute[j] - 1]->Put(barray[j], pagesize);        else	   Put(barray[j], pagesize);     }  return *this;      }SplitReturn Internal_TVNode::Split(const TVBranch &b, const TVNodehandle& thishandle, int pagesize, float min_fill_percent, int sig_dim){ // cout << "----------\n";// cout << "Splitting :\n";// for (int xyy = 0; xyy < count; xyy++)//    cout << xyy << "  " << entry[xyy].GetBound() << endl;//cout << "new   " << b << endl;   SplitReturn sret(count + 1);   TVBranch *barray = new TVBranch[count + 1];   int i = 0;   for (; i < count; i++)          barray[i] = entry[i];   barray[count] = b;   // The splitting algorithm   SplitTVBranchAlg(sret, barray, FixSize(), pagesize, min_fill_percent, sig_dim);               // Rebuilt the nodes   ReDistribute(sret, barray, pagesize);//cout << "SplitReturn : " << sret.bound[0] << "  " << sret.bound[1] << endl;   thishandle.write();   delete [] barray;   return sret;}SplitReturn Internal_TVNode::Split(const Leaf_Element &e, const TVNodehandle& nh, VCOM_TYPE (*gfeat)(int, char*), int pagesize, float min_fill_percent, int sig_dim){  assert(0);  SplitReturn srt(1);  return srt;}void Internal_TVNode::SetReInsert(const Leaf_Element& b, ReInsertClass& ric, const TVNodehandle& nh, float reinsert_percent, int pagesize, float min_fill_percent, int sig_dim){  assert(0);}int sort_ricarray(const void *ric1, const void *ric2){   int out1;   float d1, d2;   TVector v1, v2;   d1 =  ((ReInsertCal *)ric1)->distance;   d2 =  ((ReInsertCal *)ric2)->distance;   out1 = (abs(d1 - d2) < abs(PRECISION * d1)) && (abs(d1 - d2) < abs(PRECISION * d2));   if (!(out1))      {      if ((d1 - d2) > 0)         return(1);      else         return(-1);      }   v1 =  ((ReInsertCal *)ric1)->ne.GetTVector();   v2 =  ((ReInsertCal *)ric2)->ne.GetTVector();   if (v1 < v2)      out1 = -1 ;   else      out1 = (v1 > v2);   return out1;}void Internal_TVNode::SetReInsert(const TVBranch& b, ReInsertClass& ric, const TVNodehandle& thishandle, float reinsert_percent, int pagesize, float min_fill_percent, int sig_dim){   TVNodeEntry *narray = new TVNodeEntry[count + 1];   TVBranch *barray = new TVBranch[count + 1];   TVRectangle *darray = new TVRectangle[count + 1];   ReInsertCal *ricarray = new ReInsertCal[count + 1];   ReInsertCal swap;   int total_branch = count + 1;   int cursize, requiresize;   TVRectangle bound;   int i;   for (i = 0; i < count; i++)      {         // need to do this, because TVNodeEntry have only pointers         barray[i] = entry[i];         ricarray[i].ne.Put(barray[i]);         darray[i] = barray[i].GetBound();      }   bound = MinBoundTVRectangle(darray, count, sig_dim);   barray[count] = b;   ricarray[count].ne.Put(barray[count]);   for (i = 0;  i < count; i++)      {        ricarray[i].distance = bound.GetCenter().Distance(barray[i].GetBound().GetCenter().ProjectFront(bound.GetCenter().GetDim()));      }   ricarray[count].distance = bound.GetCenter().Distance(b.GetBound().GetCenter().ProjectFront(bound.GetCenter().GetDim()));   qsort(ricarray, total_branch, sizeof(ReInsertCal), sort_ricarray);   int reinsert_size = 0;   int flag = TRUE;   i = count;   cursize = Size() + b.Size();   requiresize = (int)(pagesize * (100 - reinsert_percent) / 100);   while (cursize > requiresize)     {       cursize -= ricarray[i--].ne.u.b->Size();     }   if (cursize < (pagesize * min_fill_percent) / 100)      {        cursize +=  ricarray[++i].ne.u.b->Size();        if (cursize > pagesize)           {             // encounter a large element             swap = ricarray[i];             ricarray[i] = ricarray[0];             ricarray[0] = swap;             cursize = Size() + b.Size();             while (cursize > requiresize)               {                  cursize -= ricarray[i--].ne.u.b->Size();               }           }      }  // 0..i is to keep, reinsert others  int j;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
激情五月婷婷综合| 精品一区二区三区日韩| 久久精品视频免费| 91精品国产综合久久精品性色| 91蜜桃在线观看| av电影天堂一区二区在线观看| 成人性视频网站| 国产98色在线|日韩| 成人免费视频视频在线观看免费| 国产精品69毛片高清亚洲| 国产 日韩 欧美大片| 从欧美一区二区三区| 99国内精品久久| 欧美性色黄大片| 91精品国产一区二区三区蜜臀| 91精品国产aⅴ一区二区| 欧美一区二区三区四区高清| 日韩午夜精品视频| 国产情人综合久久777777| 国产精品久久久久久户外露出| 亚洲免费毛片网站| 麻豆精品一区二区| 国产传媒一区在线| 色网站国产精品| 欧美一级二级在线观看| 国产亚洲精品7777| 亚洲精品一卡二卡| 久久精品国产亚洲aⅴ| 国产激情一区二区三区四区 | 欧美亚洲国产怡红院影院| 在线亚洲+欧美+日本专区| 欧美一二三在线| 国产精品天干天干在线综合| 性感美女极品91精品| 国产精品自拍在线| 欧美无人高清视频在线观看| 久久亚洲精华国产精华液| 专区另类欧美日韩| 久久超级碰视频| 91啪在线观看| 久久人人爽爽爽人久久久| 亚洲免费大片在线观看| 九色porny丨国产精品| 在线精品亚洲一区二区不卡| 久久先锋影音av鲁色资源 | 在线免费亚洲电影| 精品国产免费人成在线观看| 一区二区在线观看免费 | 欧美国产欧美亚州国产日韩mv天天看完整| 亚洲视频免费在线观看| 国产一区欧美日韩| 欧美一区二区三区系列电影| 亚洲精品高清在线| 丁香天五香天堂综合| 日韩视频在线永久播放| 亚洲国产精品久久久久秋霞影院| 福利视频网站一区二区三区| 欧美电影精品一区二区| 亚洲第一电影网| 在线观看91视频| 亚洲欧洲综合另类| 99久久久无码国产精品| 国产农村妇女毛片精品久久麻豆| 日本欧美韩国一区三区| 欧美美女bb生活片| 亚洲一级不卡视频| 欧美影片第一页| 樱花草国产18久久久久| 日本精品一区二区三区高清| 国产精品国产三级国产普通话三级| 国产一区二区三区四区在线观看| 日韩欧美国产一区二区三区| 日本欧美大码aⅴ在线播放| 欧美日韩一卡二卡三卡| 午夜激情综合网| 欧美精品色一区二区三区| 亚洲第一精品在线| 欧美精品丝袜中出| 青青草国产精品97视觉盛宴| 91精品免费在线| 奇米888四色在线精品| 日韩一区二区三免费高清| 日本伊人色综合网| 日韩你懂的在线观看| 国产综合久久久久久鬼色| 久久综合九色综合久久久精品综合 | 男女男精品视频| 欧美一区二区三区视频免费播放| 日韩精品一卡二卡三卡四卡无卡| 欧美蜜桃一区二区三区| 日本欧美久久久久免费播放网| 欧美成人女星排名| 国产精品一区二区三区99| 国产精品网友自拍| 色一情一伦一子一伦一区| 午夜成人免费视频| 欧美成人午夜电影| 99精品视频一区| 午夜精品久久久久久| www国产成人免费观看视频 深夜成人网| 国产精品综合在线视频| 18成人在线观看| 4hu四虎永久在线影院成人| 国产精品综合一区二区| 亚洲嫩草精品久久| 日韩欧美123| 波多野结衣在线aⅴ中文字幕不卡| 亚洲一区二区三区视频在线| 欧美大度的电影原声| av一区二区三区黑人| 日韩avvvv在线播放| 国产女同互慰高潮91漫画| 欧美日韩精品福利| 成人免费视频网站在线观看| 性欧美疯狂xxxxbbbb| 亚洲国产精品成人综合色在线婷婷 | 97久久精品人人澡人人爽| 午夜成人免费电影| 国产精品成人免费在线| 69精品人人人人| 成人h动漫精品| 精品制服美女丁香| 一区二区三区在线看| 国产亚洲综合在线| 欧美一区二区视频在线观看| 99久久精品免费| 国产精品一品二品| 日韩成人av影视| 亚洲最大成人综合| 中日韩免费视频中文字幕| 欧美一级专区免费大片| 色婷婷久久综合| 成人午夜av电影| 国产尤物一区二区| 看片的网站亚洲| 偷拍日韩校园综合在线| 亚洲女女做受ⅹxx高潮| 国产无遮挡一区二区三区毛片日本| 欧美日韩的一区二区| 一本色道a无线码一区v| 成人国产精品免费观看动漫| 国产在线播放一区| 久久99国产精品成人| 免费观看在线综合| 天天色 色综合| 午夜精品福利一区二区蜜股av| 亚洲精选视频免费看| 亚洲免费在线视频| 亚洲精品久久嫩草网站秘色| 国产精品久久三区| 国产精品久久久爽爽爽麻豆色哟哟| 欧美精品一区二区蜜臀亚洲| 精品福利av导航| 精品粉嫩超白一线天av| 久久久久久电影| 久久久噜噜噜久久中文字幕色伊伊| 欧美一级二级在线观看| 日韩一区和二区| 久久综合色综合88| 久久久久国产成人精品亚洲午夜| 久久亚洲一区二区三区明星换脸| 久久综合色一综合色88| 国产清纯美女被跳蛋高潮一区二区久久w| 精品国产伦一区二区三区免费| 久久丝袜美腿综合| 国产视频一区二区在线| 国产精品久久久久久久久免费相片 | 亚洲国产欧美在线| 日韩av一级片| 精品一区二区在线视频| 国产福利一区二区三区视频在线| 国产成人一区在线| 91蜜桃免费观看视频| 欧美视频中文一区二区三区在线观看| 欧美日韩的一区二区| 精品日产卡一卡二卡麻豆| 久久精品免费在线观看| 亚洲欧美日韩在线| 日韩电影在线看| 福利一区二区在线观看| 精品久久人人做人人爱| 国产精品视频yy9299一区| 亚洲伊人色欲综合网| 免费高清在线一区| 99精品久久99久久久久| 欧美日韩国产精品自在自线| 2014亚洲片线观看视频免费| 国产精品盗摄一区二区三区| 午夜久久电影网| 国产精品1024久久| 欧美日韩精品一区二区三区| 欧美精品一区男女天堂| 一区二区在线看| 国产酒店精品激情| 欧美伦理电影网| 中文字幕中文在线不卡住| 麻豆久久一区二区| 在线观看一区二区精品视频| 久久久久久毛片| 日韩中文字幕亚洲一区二区va在线|