X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=XMLTree.h;h=9b79ae3eab6040b473c0eb65473aabf4ea4836bd;hb=06201fcce6255906ad6b4d305b8e643c634780a3;hp=3bfb7a401db4e001ce2fa2cbb2de8a15c1f906a9;hpb=d6ecf291b7dd99ec191daa090a2ff3dac08f8150;p=SXSI%2FXMLTree.git diff --git a/XMLTree.h b/XMLTree.h index 3bfb7a4..9b79ae3 100644 --- a/XMLTree.h +++ b/XMLTree.h @@ -21,7 +21,7 @@ #ifndef XMLTREE_H_ #define XMLTREE_H_ -#include "TextCollection/TextCollection.h" +#include "TextCollection/TextCollectionBuilder.h" #include #include #include @@ -37,6 +37,7 @@ #include #include using SXSI::TextCollection; +using SXSI::TextCollectionBuilder; // this constant is used to efficiently compute the child operation in the tree @@ -88,7 +89,9 @@ class XMLTree { uint tags_blen, tags_len; /** The texts in the XML document */ + TextCollectionBuilder *TextBuilder; TextCollection *Text; + /** The texts in the XML document (cached for faster display) */ vector CachedText; @@ -122,9 +125,10 @@ class XMLTree { bool disable_tc; public: + void print_stats(); /** Data structure constructor */ - XMLTree() {finished = false; initialized = false;}; + XMLTree() {finished = false; initialized = false; Text = 0; TextBuilder = 0; }; /** Data structure destructor */ ~XMLTree(); @@ -206,9 +210,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 @@ -219,6 +235,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); @@ -249,6 +267,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 @@ -315,7 +334,7 @@ public: TagType RegisterTag(unsigned char *tagname); bool EmptyText(DocID i) { - return Text->EmptyText(i); + return Text->EmptyText(i); } /** Prefix(s): search for texts prefixed by string s. */ TextCollection::document_result Prefix(uchar const *s) { @@ -370,6 +389,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) { @@ -399,7 +423,7 @@ public: /** GetText(d): returns the text corresponding to document with * id d. */ uchar* GetText(DocID d) { - return Text->GetText(d); + return Text->GetText(d); } uchar* GetCachedText(DocID d) {