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