?? indextest.c
字號:
/* 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: indextest.C,v 1.6 1996/04/18 21:50:24 kilin Exp kilin $ #include <iostream.h>#include <fstream.h>#include <assert.h>#include <stdlib.h>#include <String.h>#include "TVdefine.h"#include "TVconstants.h"#include "TVvector.h"#include "TVelement.h"#include "TVrectangle.h"#include "TVsimbuf.h"#include "TVnode.h"#include "TVindexstat.h"#include "TVindexpara.h"#include "TVindex.h"#include "TVutil.h"#include "dataadd.h"#include "indextest.h"extern "C" { char* strcpy(char*, const char*); int strcmp(const char*, const char*);// unsigned int strlen(const char*);}#define DEBUG 1Storage *globstorage;int eletested;TVector GetTVector(DataPoints& dp, int dim = 0){ dim = (dim ? dim : 30); TVector v(dim); for (int i = 0; i < dim; i++) v[i] = dp[i]; return v;}TestPara::TestPara() : ip(default_pagesize, default_sig_dim, default_min_fill_percent, default_reinsert_percent, default_pickbranch_compare_count){ optionfromfile = FALSE; strcpy(osfilename, default_osfilename); loadindex = FALSE; strcpy(lifilename, default_lifilename); performinsert = TRUE; performsearch = TRUE; numinput= default_numinput; inskip= default_inskip; numsearch= default_numsearch; searchskip= default_searchskip; searchskiphead= default_searchskiphead; searchdist= default_searchdist; searchcode = searchall; searchoption = searchexact; searchprint = FALSE; searchprintfile = NULL; strcpy(ifilename, default_ifilename); strcpy(sfilename, default_sfilename); saveindex = FALSE; strcpy(svfilename, default_svfilename); printindex = FALSE; onedataperline = TRUE; checkvalid = FALSE; buffersize = default_buffersize; disktime = default_disktime; quicksearch = FALSE;}void ChangeOptions(int argc, char *argv[], TestPara& tp){ for (int i = 2; i <= argc; i++) { if (!strcmp(argv[i-1], "-optf")) // option file { tp.optionfromfile = TRUE; strcpy(tp.osfilename, argv[i++]); i = argc + 1; } else if (!strcmp(argv[i-1], "-li")) // insert or search { tp.loadindex = TRUE; tp.performinsert = FALSE; strcpy(tp.lifilename, argv[i++]); } else if (!strcmp(argv[i-1], "-ps")) // page size { tp.ip.SetPageSize(atoi(argv[i++])); } else if (!strcmp(argv[i-1], "-ud")) // unfold dim { tp.ip.SetUnfoldDim(atoi(argv[i++])); } else if (!strcmp(argv[i-1], "-mfp")) // min fill percent { tp.ip.SetMinFillPercent(atof(argv[i++])); } else if (!strcmp(argv[i-1], "-rtp.ip")) // reinsert percentage { tp.ip.SetReinsertPercent(atof(argv[i++])); } else if (!strcmp(argv[i-1], "-pbcp")) // pickbranch compare percentage { tp.ip.SetPickTVBranchCompareCount(atoi(argv[i++])); } else if (!strcmp(argv[i-1], "-ni")) // no insertion { tp.performinsert = FALSE; } else if (!strcmp(argv[i-1], "-if")) // insert file name { strcpy(tp.ifilename, argv[i++]); } else if (!strcmp(argv[i-1], "-ic")) // input count { tp.performinsert = TRUE; tp.numinput = atoi(argv[i++]); } else if (!strcmp(argv[i-1], "-isc")) // input skip count { tp.inskip = atoi(argv[i++]); } else if (!strcmp(argv[i-1], "-ns")) // no search { tp.performsearch = FALSE; } else if (!strcmp(argv[i-1], "-sf")) // search file name { strcpy(tp.sfilename, argv[i++]); } else if (!strcmp(argv[i-1], "-sc")) // search count { tp.numsearch = atoi(argv[i++]); } else if (!strcmp(argv[i-1], "-ssc")) // search skip count { tp.searchskip = atoi(argv[i++]); } else if (!strcmp(argv[i-1], "-sshc")) // search skip head { tp.searchskiphead = atoi(argv[i++]); } else if (!strcmp(argv[i-1], "-se")) // search exist { tp.searchcode = searchexist; } else if (!strcmp(argv[i-1], "-sap")) // search approx rectangle { tp.searchoption = searchappdia; tp.searchdist = atoi(argv[i++]); } else if (!strcmp(argv[i-1], "-saq")) // search approx rectangle { tp.searchoption = searchappsq; tp.searchdist = atoi(argv[i++]); } else if (!strcmp(argv[i-1], "-sed")) // search approx word { tp.searchoption = searcheditdist; tp.searchdist = atoi(argv[i++]); } else if (!strcmp(argv[i-1], "-sedns")) // search approx word { tp.searchoption = searcheditdistnosub; tp.searchdist = atoi(argv[i++]); } else if (!strcmp(argv[i-1], "-sp")) // print all found elements { tp.searchprint = TRUE; if ((i < argc) && (argv[i][0] != '-')) { tp.searchprintfile = new char[strlen(argv[i]) + 1]; strcpy(tp.searchprintfile, argv[i++]); } } else if (!strcmp(argv[i-1], "-nsv")) // no save index { tp.saveindex = FALSE; } else if (!strcmp(argv[i-1], "-svi")) // save file name { tp.saveindex = TRUE; if ((i < argc) && (argv[i][0] != '-')) strcpy(tp.svfilename, argv[i++]); } else if (!strcmp(argv[i-1], "-pi")) // print index { tp.printindex = TRUE; } else if (!strcmp(argv[i-1], "-pin")) // print index { tp.printindex = TRUE; tp.onedataperline = FALSE; } else if (!strcmp(argv[i-1], "-cv")) // check validity { tp.checkvalid = TRUE; } else if (!strcmp(argv[i-1], "-dd")) // set dimension of data { DataPoints::dim = atoi(argv[i++]); } else if (!strcmp(argv[i-1], "-bs")) // input count { tp.buffersize = atoi(argv[i++]); } else if (!strcmp(argv[i-1], "-dt")) // input count { tp.disktime = atoi(argv[i++]); } else if (!strcmp(argv[i-1], "-qs")) // no save index { tp.quicksearch = TRUE; } }}void PrintOptions(TestPara& tp){ if (tp.loadindex) cout << "Index read from file : " << tp.lifilename << "\n\n"; else { cout << "Index built from scratch.\n"; cout << "Index parameters :\n"; cout << tp.ip; cout << "\n\n"; } if (tp.performinsert) { cout << "Insert from file " << tp.ifilename << "\n"; cout << "Number of elements inserted " << tp.numinput << "\n"; cout << "Skip between element inserted : " << tp.inskip << "\n"; } else cout << "No insertion performed\n"; cout << endl << endl; if (tp.performsearch) { switch (tp.searchoption) { case searchexact : cout << "Exact search performed"; break; case searchappdia : cout << "Approximate search rectangle region with radius " << tp.searchdist; break; case searchappdis : cout << "Approximate search with distance (no filtering) " << tp.searchdist; break; case searcheditdist : cout << "Approximate search with editing distance (do filtering) " << tp.searchdist; break; default : break;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -