\r
// loads the texts\r
if (!XML_Tree->disable_tc){\r
- XML_Tree->Text = TextCollection::InitTextCollection(sample_rate_text);\r
- XML_Tree->Text->Load(fp,sample_rate_text);\r
+ XML_Tree->Text = TextCollection::Load(fp,sample_rate_text);\r
int sst;\r
int st;\r
ufread(&sst, sizeof(int),1,fp);\r
Tags = NULL;\r
\r
//Text->~TextCollection();\r
- delete Text;\r
+ delete TextBuilder; \r
+ TextBuilder = NULL;\r
+ delete Text; \r
Text = NULL;\r
\r
initialized = false;\r
if (!indexing_empty_texts) \r
empty_texts_aux = (unsigned int *)umalloc(sizeof(unsigned int));\r
\r
- \r
- \r
- Text = TextCollection::InitTextCollection((unsigned)sample_rate_text);\r
+ if (disable_tc)\r
+ TextBuilder = 0;\r
+ else \r
+ TextBuilder = new TextCollectionBuilder((unsigned)sample_rate_text);\r
+ Text = 0;\r
\r
return 1; // indicates success in the initialization of the data structure\r
}\r
\r
// If we found an attribute then "<@>" is present in the tree\r
// if we didn't then it is not. "<$>" is never present in the tree\r
- //uint max_tag = 0;\r
- //for(uint i=0;i<(uint)npar-1;i++)\r
- // max_tag = max(max_tag,tags_aux[i]);\r
+ uint max_tag = 0;\r
+ for(uint i=0;i<(uint)npar-1;i++)\r
+ max_tag = max(max_tag,tags_aux[i]);\r
//max_tag++;\r
//tags_aux = (TagType *) urealloc(tags_aux, sizeof(TagType)*(npar + 1));\r
//tags_aux[npar++] = max_tag;\r
//delete ssb;\r
\r
\r
- // makes the text collection static\r
+ // makes the text collection static\r
if (!disable_tc)\r
- Text->MakeStatic();\r
- \r
+ {\r
+ assert(Text = 0);\r
+ assert(TextBuilder != 0);\r
+ Text = TextBuilder->InitTextCollection();\r
+ delete TextBuilder;\r
+ TextBuilder = 0;\r
+ }\r
+\r
// creates the data structure marking the non-empty texts (just in the case it is necessary)\r
if (!indexing_empty_texts) {\r
EBVector = new static_bitsequence_rrr02((uint *)empty_texts_aux,(ulong)npar,(uint)32);\r
bitset(empty_texts_aux, npar-1); // marks the non-empty text with a 1 in the bit vector\r
}\r
\r
- Text->InsertText(s);\r
+ TextBuilder->InsertText(s);\r
string cpps = (char*) s;\r
CachedText.push_back(cpps); \r
\r
\r
bitclean(empty_texts_aux, npar-1); // marks the empty text with a 0 in the bit vector\r
}\r
- else Text->InsertText(&c); // we insert the empty text just in case we index all the texts\r
+ else TextBuilder->InsertText(&c); // we insert the empty text just in case we index all the texts\r
\r
return 1; // success \r
}\r