X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=timeTextCollection.cpp;h=47d19760ce7119da70ebd5e91dbde12abf6c6cf4;hb=40ddf9aca842bdc081b6350a4ebfe36b066c94c9;hp=91c940456858e2cd9e3d184251a3cfdc31b78b95;hpb=af8938dbee21244687184dd0502a84ce1af70c50;p=SXSI%2FTextCollection.git diff --git a/timeTextCollection.cpp b/timeTextCollection.cpp index 91c9404..47d1976 100644 --- a/timeTextCollection.cpp +++ b/timeTextCollection.cpp @@ -18,8 +18,9 @@ static struct timeval t2; -#include "TextCollection.h" +#include "TextCollectionBuilder.h" using SXSI::TextCollection; +using SXSI::TextCollectionBuilder; int main(int argc, char**argv) { @@ -35,7 +36,7 @@ int main(int argc, char**argv) - TextCollection *csa = TextCollection::InitTextCollection(64); + TextCollectionBuilder *tcb = new TextCollectionBuilder(64); STARTTIMER(); @@ -44,7 +45,7 @@ int main(int argc, char**argv) while (not(cin.eof()) && num_str < 100000 ){ getline(cin,str); // Read line by line. if (str.compare("----------") == 0){ - csa->InsertText((unsigned char*) buffer.c_str()); + tcb->InsertText((unsigned char*) buffer.c_str()); if (num_str % 10000 == 0){ STOPTIMER(); @@ -65,7 +66,7 @@ int main(int argc, char**argv) }; std::cerr << "Calling MakeStatic()\n"; - csa->MakeStatic(); + TextCollection *tc = tcb->InitTextCollection(); std::cerr << "Statistics: " << num_str << " strings, " << max_str << " = max length\n"; int count; @@ -74,7 +75,7 @@ int main(int argc, char**argv) for (unsigned int i = 0; i < (sizeof(words)/sizeof(char*)) ; i++){ STARTTIMER(); - is = csa->IsContains((unsigned char*) words[i].c_str()); + is = tc->IsContains((unsigned char*) words[i].c_str()); STOPTIMER(); time = GETTIME(); @@ -82,7 +83,7 @@ int main(int argc, char**argv) STARTTIMER(); - count = csa->Count((unsigned char*) words[i].c_str()); + count = tc->Count((unsigned char*) words[i].c_str()); STOPTIMER(); time = GETTIME(); @@ -90,7 +91,7 @@ int main(int argc, char**argv) STARTTIMER(); - count = csa->CountContains((unsigned char*) words[i].c_str()); + count = tc->CountContains((unsigned char*) words[i].c_str()); STOPTIMER(); time = GETTIME(); @@ -98,7 +99,7 @@ int main(int argc, char**argv) STARTTIMER(); - res = csa->Contains((unsigned char*) words[i].c_str()); + res = tc->Contains((unsigned char*) words[i].c_str()); STOPTIMER(); time = GETTIME();