X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=XMLTree.cpp;h=2a1da8446a816ab17117963aea34bc785b4945ca;hb=935f20b93a3db7cd2f9f39573d4ab434fcc4356a;hp=249143cfbe456ffc8d78d10262f82167baa773dd;hpb=7d4c73ab6327740b299e2fbd9bff4b2a3b82a409;p=SXSI%2FXMLTree.git diff --git a/XMLTree.cpp b/XMLTree.cpp index 249143c..2a1da84 100644 --- a/XMLTree.cpp +++ b/XMLTree.cpp @@ -566,13 +566,14 @@ treeNode XMLTree::TaggedDesc(treeNode x, TagType tag) exit(1); } - int r, s; + //int r, s; treeNode y; if (isleaf(Par,x)) return NULLT; - r = (int) Tags->rank(tag, node2tagpos(x)); - s = (int) Tags->select(tag, r+1); + int s = (int) Tags->select_next(tag,node2tagpos(x)); + /*r = (int) Tags->rank(tag, node2tagpos(x)); + s = (int) Tags->select(tag, r+1);*/ if (s == -1) return NULLT; // there is no such node y = tagpos2node(s); // transforms the tag position into a node position if (!is_ancestor(Par, x, y)) return NULLT; // the next node tagged tag (in preorder) is not within the subtree of x. @@ -659,14 +660,15 @@ treeNode XMLTree::TaggedDescOrFollOnly(treeNode x,TagType *folltags, unsigned in { treeNode res,y,lim; - int r,s; + //int r,s; lim = find_close(Par,root); res=NULLT; for (unsigned int i = 0; i < ftlen; i ++ ) { - r = (int) Tags->rank(folltags[i], node2tagpos(x)); - s = (int) Tags->select(folltags[i], r+1); + int s = (int) Tags->select_next(folltags[i],node2tagpos(x)); + /*r = (int) Tags->rank(folltags[i], node2tagpos(x)); + s = (int) Tags->select(folltags[i], r+1);*/ if (s == -1) y = NULLT; // there is no such node else { @@ -762,12 +764,13 @@ treeNode XMLTree::TaggedFoll(treeNode x, TagType tag) exit(1); } - int r, s; + //int r, s; if (x ==NULLT || x == Root()) return NULLT; - - r = (int) Tags->rank(tag, find_close(Par, x)); - s = (int) Tags->select(tag, r+1); // select returns -1 in case that there is no r+1-th tag. + + int s = (int) Tags->select_next(tag,find_close(Par,x)); + /*r = (int) Tags->rank(tag, find_close(Par, x)); + s = (int) Tags->select(tag, r+1); // select returns -1 in case that there is no r+1-th tag. */ if (s==-1) return NULLT; else return tagpos2node(s); } @@ -777,13 +780,14 @@ treeNode XMLTree::TaggedFoll(treeNode x, TagType tag) treeNode XMLTree::TaggedFollBelow(treeNode x, TagType tag, treeNode root) { - int r, s; + //int r, s; int lim = node2tagpos(find_close(Par,root)); if (x ==NULLT || x == Root()) return NULLT; - r = (int) Tags->rank(tag,find_close(Par,x)); - s = (int) Tags->select(tag, r+1); // select returns -1 in case that there is no r+1-th tag. + int s = (int) Tags->select_next(tag,find_close(Par,x)); + /*r = (int) Tags->rank(tag,find_close(Par,x)); + s = (int) Tags->select(tag, r+1); // select returns -1 in case that there is no r+1-th tag.*/ if (s==-1 || s >= lim) return NULLT; else @@ -800,14 +804,15 @@ treeNode XMLTree::TaggedFollowingSibling(treeNode x, TagType tag) exit(1); } - int r, s; + //int r, s; treeNode ns = next_sibling(Par,x); if (x == NULLT || x == Root() || ns == -1) return NULLT; - r = (int) Tags->rank(tag, node2tagpos(ns)-1); - s = (int) Tags->select(tag, r+1); // select returns -1 in case that there is no r+1-th tag. + int s = (int) Tags->select_next(tag,node2tagpos(ns)-1); + /*r = (int) Tags->rank(tag, node2tagpos(ns)-1); + s = (int) Tags->select(tag, r+1); // select returns -1 in case that there is no r+1-th tag.*/ if (s==-1) return NULLT; else return tagpos2node(s); }