Jouni's Incremental BWT integrated into TextCollection
[SXSI/TextCollection.git] / timeTextCollection.cpp
index 91c9404..47d1976 100644 (file)
@@ -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();