From 41ca14161f53191521d3ea3967ea9184a5a2ae39 Mon Sep 17 00:00:00 2001 From: kim Date: Sun, 31 May 2009 19:40:47 +0000 Subject: [PATCH] Added XMLTree::Closing XMLTree::IsOpen git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/XMLTree@425 3cdefd35-fc62-479d-8e8d-bae585ffb9ca --- XMLTree.cpp | 4 ++++ XMLTree.h | 54 ++++++++++++++--------------------------------------- 2 files changed, 18 insertions(+), 40 deletions(-) diff --git a/XMLTree.cpp b/XMLTree.cpp index e68ef30..51c495d 100644 --- a/XMLTree.cpp +++ b/XMLTree.cpp @@ -768,3 +768,7 @@ TagType XMLTree::RegisterTag(unsigned char *tagname) } +treeNode XMLTree::Closing(treeNode x) { + return find_close(Par,x); +} +bool XMLTree::IsOpen(treeNode x) { return inspect(Par,x); } diff --git a/XMLTree.h b/XMLTree.h index ee44d32..a62abfe 100644 --- a/XMLTree.h +++ b/XMLTree.h @@ -40,7 +40,7 @@ #include using SXSI::TextCollection; using SXSI::TextCollectionBuilder; -using SXSI::TextStorage; + // this constant is used to efficiently compute the child operation in the tree #define OPTD 10 @@ -325,20 +325,6 @@ public: TextCollection::document_result LessThan(uchar const *s) { return Text->LessThan(s); } - - /** KMismatches (s): returns document identifiers for the texts that - * contain occurrence of string s with at most K mismatches. */ - TextCollection::document_result KMismatches(uchar const *s, unsigned K) { - return Text->KMismatches(s, K); - } - - /** KErrors (s): returns document identifiers for the texts that - * contain occurrence of string s with at most K errors. - * The accepted "errors" are insertions, deletions and mutations of chars. - */ - TextCollection::document_result KErrors(uchar const *s, unsigned K) { - return Text->KErrors(s, K); - } /** IsPrefix(x): returns true if there is a text prefixed by string s. */ bool IsPrefix(uchar const *s) { @@ -399,34 +385,18 @@ public: } /** GetText(d): returns the text corresponding to document with - * id d. - * - * Implementation of GetText() may or may NOT - * require you to free() the pointer that is returned. - * Call DeleteText() for each pointer returned by GetText() - * to avoid possible memory leaks. - */ - uchar* GetText(DocID d) const { - return Text->GetText(d); - } - - /** - * Free the pointer returned by GetText(). - */ - void DeleteText(uchar *text) const { - Text->DeleteText(text); + * id d. */ + uchar* GetText(DocID d) { + uchar * s = Text->GetText(d); + return (s[0] == 1 ? (uchar*)"" : s); } /** GetText(i, j): returns the texts corresponding to documents with - * ids i, i+1, ..., j. Texts are separated by '\0' character. - * - * Call DeleteText() for each pointer returned by GetText() - * to avoid possible memory leaks. - */ - uchar* GetText(DocID i, DocID j) const { - return Text->GetText(i, j); - } - + * ids i, i+1, ..., j. Texts are separated by '\0' character. */ + // uchar* GetText(DocID i, DocID j) { + // uchar * s = Text->GetText(i, j); + // return (s[0] == 1 ? (uchar*)"" : s); + //} TextCollection *getTextCollection() { return Text; @@ -442,6 +412,10 @@ public: void insertTag(TagType tag, uint position); void print_stats(); + + treeNode Closing(treeNode x); + bool IsOpen(treeNode x); + }; #endif -- 2.17.1