X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=XMLTree.h;h=2e9e222ae53f26baa631dbf4ab77dff885173fc8;hb=317fdc10a3d537fd87b855c4b8714b2472cde608;hp=a00487ac710eb82d96cdcf94437fa541fff3692b;hpb=dd9992dcd5366f37820c24ed7cddf24ecbc0d549;p=SXSI%2FXMLTree.git diff --git a/XMLTree.h b/XMLTree.h index a00487a..2e9e222 100644 --- a/XMLTree.h +++ b/XMLTree.h @@ -84,9 +84,13 @@ 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; + /** The texts in the XML document (cached for faster display) */ + vector CachedText; /** Flag indicating whether the whole data structure has been constructed or * not. If the value is true, you cannot add more texts, nodes, etc. */ @@ -118,6 +122,7 @@ class XMLTree { bool disable_tc; public: + void print_stats(); /** Data structure constructor */ XMLTree() {finished = false; initialized = false;}; @@ -215,7 +220,14 @@ public: * preorder than x and not in the subtree of x. Returns NULLT if there * is none. */ treeNode TaggedFoll(treeNode x, TagType tag); - + + /** TaggedFollowingSibling(x,tag) */ + treeNode TaggedFollowingSibling(treeNode x, TagType tag); + + /** TaggedAncestor(x, tag): returns the closest ancestor of x tagged + * tag. Return NULLT is there is none. */ + treeNode TaggedAncestor(treeNode x, TagType tag); + /** PrevText(x): returns the document identifier of the text to the left of * node x, or NULLT if x is the root node. */ DocID PrevText(treeNode x); @@ -390,6 +402,12 @@ public: uchar* GetText(DocID d) { return Text->GetText(d); } + + uchar* GetCachedText(DocID d) { + uchar * str = (uchar*) calloc(sizeof(char),(CachedText.at(d).size() + 1)); + strcpy((char*) str,(const char*) CachedText.at(d).c_str()); + return (uchar*) (str); + } TextCollection *getTextCollection() { return Text;