Added TaggedFollBelow
[SXSI/XMLTree.git] / XMLTree.h
index d446ab1..80173a4 100644 (file)
--- a/XMLTree.h
+++ b/XMLTree.h
@@ -84,6 +84,8 @@ class XMLTree {
                      \r
    /** Tag sequence represented with a data structure for rank and select */\r
    static_sequence *Tags;\r
+        uint * tags_fix;\r
+        uint tags_blen, tags_len;\r
 \r
    /** The texts in the XML document */\r
    TextCollection *Text;\r
@@ -120,6 +122,7 @@ class XMLTree {
    bool disable_tc;\r
    \r
 public:\r
+        void print_stats();\r
 \r
    /** Data structure constructor */\r
    XMLTree() {finished = false; initialized = false;}; \r
@@ -204,9 +207,21 @@ public:
     * is none. */\r
    treeNode TaggedDesc(treeNode x, TagType tag);\r
 \r
-   /** TaggedNext(x,tag): returns the first node tagged tag with larger \r
-    * preorder than x. Returns NULT if there is none. */\r
-   treeNode TaggedNext(treeNode x, TagType tag);\r
+\r
+   treeNode TaggedBelow(treeNode x, TagType *childtags, unsigned int ctlen,\r
+                                TagType *desctags, unsigned int dtlen);\r
+   \r
+   treeNode TaggedNext(treeNode x, TagType *childtags, unsigned int ctlen,\r
+                               TagType *folltags, unsigned int flen,treeNode root);\r
+\r
+   treeNode TaggedDescOnly(treeNode x, TagType *desctags, unsigned int dtlen);\r
+   \r
+   treeNode TaggedDescOrFollOnly(treeNode x, TagType *folltags, unsigned int flen,\r
+                          treeNode root);\r
+\r
+   treeNode TaggedFollOnly(treeNode x, TagType *folltags, unsigned int flen,\r
+                          treeNode root);\r
+   \r
 \r
    /** TaggedPrec(x,tag): returns the first node tagged tag with smaller \r
     * preorder than x and not an ancestor of x. Returns NULLT if there \r
@@ -217,6 +232,8 @@ public:
     * preorder than x and not in the subtree of x. Returns NULLT if there \r
     * is none. */\r
    treeNode TaggedFoll(treeNode x, TagType tag);\r
+\r
+   treeNode TaggedFollBelow(treeNode x, TagType tag,treeNode root);     \r
   \r
    /** TaggedFollowingSibling(x,tag) */\r
    treeNode TaggedFollowingSibling(treeNode x, TagType tag);\r
@@ -247,6 +264,7 @@ public:
    \r
    /** ParentNode(d): returns the parent node of document identifier d. */\r
    treeNode ParentNode(DocID d);\r
+   treeNode PrevNode(DocID d);\r
 \r
    /** OpenDocument(empty_texts,sample_rate_text,dtc): initilizes the construction\r
     * of the data structure for the XML document. Parameter empty_texts \r
@@ -368,6 +386,11 @@ public:
    bool IsLessThan(uchar const *s) {\r
       return Text->IsLessThan(s);\r
    }\r
+   \r
+   /** Count(s): Global counting  */\r
+   unsigned Count(uchar const *s) {\r
+      return Text->Count(s);\r
+   }\r
 \r
    /** CountPrefix(s): counting version of Prefix(s). */\r
    unsigned CountPrefix(uchar const *s) {\r
@@ -401,7 +424,9 @@ public:
    }\r
 \r
    uchar* GetCachedText(DocID d) {\r
-     return (uchar*) (CachedText.at(d).c_str());\r
+     uchar * str = (uchar*) calloc(sizeof(char),(CachedText.at(d).size() + 1));\r
+     strcpy((char*) str,(const char*) CachedText.at(d).c_str());\r
+     return (uchar*) (str);\r
    }\r
    \r
    TextCollection *getTextCollection() {\r