\r
#ifndef XMLTREE_H_\r
#define XMLTREE_H_\r
-\r
+#include "TextCollection/TextCollection.h"\r
#include <stdio.h>\r
#include <stdlib.h>\r
+#include <cstring>\r
#include "bp.h"\r
-#include "TextCollection/TextCollection.h"\r
+#include <static_bitsequence.h>\r
+#include <alphabet_mapper.h>\r
+#include <static_sequence.h>\r
using SXSI::TextCollection;\r
-#include "libcds/includes/static_bitsequence.h"\r
-#include "libcds/includes/alphabet_mapper.h"\r
-#include "libcds/includes/static_sequence.h"\r
-\r
\r
\r
// this constant is used to efficiently compute the child operation in the tree\r
\r
#define NULLT -1\r
\r
+#define PERM_SAMPLE 10\r
+\r
// sets bit p in e\r
#define bitset(e,p) ((e)[(p)/W] |= (1<<((p)%W)))\r
// cleans bit p in e\r
static_bitsequence_rrr02 *EBVector; \r
\r
/** Tag sequence represented with a data structure for rank and select */\r
- static_sequence_wvtree *Tags;\r
+ static_sequence *Tags;\r
\r
/** The texts in the XML document */\r
TextCollection *Text;\r
pb *par_aux;\r
TagType *tags_aux;\r
int npar;\r
+ int parArraySize;\r
int ntagnames;\r
unsigned int *empty_texts_aux;\r
\r
* Returns NULL in case that the tag identifier is not valid.*/\r
unsigned char *GetTagName(TagType tagid);\r
\r
+ /** Prefix(s): search for texts prefixed by string s. */\r
+ bool EmptyText(DocID i) {\r
+ return Text->EmptyText(i);\r
+ }\r
/** Prefix(s): search for texts prefixed by string s. */\r
TextCollection::document_result Prefix(uchar const *s) {\r
- Text->Prefix(s);\r
+ return Text->Prefix(s);\r
}\r
\r
/** Suffix(s): search for texts having string s as a suffix. */\r
TextCollection::document_result Suffix(uchar const *s) {\r
- Text->Suffix(s);\r
+ return Text->Suffix(s);\r
}\r
\r
/** Equal(s): search for texts equal to string s. */\r
TextCollection::document_result Equal(uchar const *s) {\r
- Text->Equal(s);\r
+ return Text->Equal(s);\r
}\r
\r
/** Contains(s): search for texts containing string s. */\r
TextCollection::document_result Contains(uchar const *s) {\r
- Text->Contains(s);\r
+ return Text->Contains(s);\r
}\r
\r
+ /** LessThan(s): returns document identifiers for the texts that\r
+ * are lexicographically smaller than string s. */\r
TextCollection::document_result LessThan(uchar const *s) {\r
- Text->LessThan(s);\r
+ return Text->LessThan(s);\r
}\r
- \r
+ \r
+ /** IsPrefix(x): returns true if there is a text prefixed by string s. */\r
+ bool IsPrefix(uchar const *s) {\r
+ return Text->IsPrefix(s);\r
+ } \r
+ \r
+ /** IsSuffix(s): returns true if there is a text having string s as a \r
+ * suffix.*/\r
+ bool IsSuffix(uchar const *s) {\r
+ return Text->IsSuffix(s);\r
+ }\r
+ \r
+ /** IsEqual(s): returns true if there is a text that equals given \r
+ * string s. */\r
+ bool IsEqual(uchar const *s) {\r
+ return Text->IsEqual(s);\r
+ }\r
+ \r
+ /** IsContains(s): returns true if there is a text containing string s. */\r
+ bool IsContains(uchar const *s) {\r
+ return Text->IsContains(s);\r
+ }\r
+ \r
+ /** IsLessThan(s): returns true if there is at least a text that is \r
+ * lexicographically smaller than string s. */\r
+ bool IsLessThan(uchar const *s) {\r
+ return Text->IsLessThan(s);\r
+ }\r
+\r
+ /** CountPrefix(s): counting version of Prefix(s). */\r
+ unsigned CountPrefix(uchar const *s) {\r
+ return Text->CountPrefix(s);\r
+ }\r
+ \r
+ /** CountSuffix(s): counting version of Suffix(s). */\r
+ unsigned CountSuffix(uchar const *s) {\r
+ return Text->CountSuffix(s);\r
+ }\r
+ \r
+ /** CountEqual(s): counting version of Equal(s). */\r
+ unsigned CountEqual(uchar const *s) {\r
+ return Text->CountEqual(s);\r
+ }\r
+ \r
+ /** CountContains(s): counting version of Contains(s). */\r
+ unsigned CountContains(uchar const *s) {\r
+ return Text->CountContains(s);\r
+ }\r
+ \r
+ /** CountLessThan(s): counting version of LessThan(s). */\r
+ unsigned CountLessThan(uchar const *s) {\r
+ return CountLessThan(s);\r
+ }\r
+ \r
/** GetText(d): returns the text corresponding to document with\r
* id d. */\r
uchar* GetText(DocID d) {\r
- Text->GetText(d);\r
+ return Text->GetText(d);\r
}\r
\r
+ TextCollection *getTextCollection() {\r
+ return Text;\r
+ }\r
/** Save: saves XML tree data structure to file. */\r
void Save(unsigned char *filename);\r
\r