Added XMLTree::Closing XMLTree::IsOpen
authorkim <kim@3cdefd35-fc62-479d-8e8d-bae585ffb9ca>
Sun, 31 May 2009 19:40:47 +0000 (19:40 +0000)
committerkim <kim@3cdefd35-fc62-479d-8e8d-bae585ffb9ca>
Sun, 31 May 2009 19:40:47 +0000 (19:40 +0000)
git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/XMLTree@425 3cdefd35-fc62-479d-8e8d-bae585ffb9ca

XMLTree.cpp
XMLTree.h

index e68ef30..51c495d 100644 (file)
@@ -768,3 +768,7 @@ TagType XMLTree::RegisterTag(unsigned char *tagname)
  }\r
 \r
 \r
+treeNode XMLTree::Closing(treeNode x) {\r
+  return find_close(Par,x); \r
+}\r
+bool XMLTree::IsOpen(treeNode x) { return inspect(Par,x); }\r
index ee44d32..a62abfe 100644 (file)
--- a/XMLTree.h
+++ b/XMLTree.h
@@ -40,7 +40,7 @@
 #include <static_sequence.h>\r
 using SXSI::TextCollection;\r
 using SXSI::TextCollectionBuilder;\r
-using SXSI::TextStorage;\r
+\r
 \r
 // this constant is used to efficiently compute the child operation in the tree\r
 #define OPTD 10\r
@@ -325,20 +325,6 @@ public:
    TextCollection::document_result LessThan(uchar const *s) {\r
       return Text->LessThan(s);\r
    }\r
-\r
-   /** KMismatches (s): returns document identifiers for the texts that\r
-    * contain occurrence of string s with at most K mismatches. */\r
-   TextCollection::document_result KMismatches(uchar const *s, unsigned K) {\r
-       return Text->KMismatches(s, K);\r
-   }\r
-\r
-   /** KErrors (s): returns document identifiers for the texts that\r
-    * contain occurrence of string s with at most K errors. \r
-    * The accepted "errors" are insertions, deletions and mutations of chars.\r
-    */\r
-   TextCollection::document_result KErrors(uchar const *s, unsigned K) {\r
-       return Text->KErrors(s, K);\r
-   }\r
    \r
    /** IsPrefix(x): returns true if there is a text prefixed by string s. */\r
    bool IsPrefix(uchar const *s) {\r
@@ -399,34 +385,18 @@ public:
    }\r
    \r
    /** GetText(d): returns the text corresponding to document with\r
-    * id d. \r
-    *\r
-    * Implementation of GetText() may or may NOT \r
-    * require you to free() the pointer that is returned.\r
-    * Call DeleteText() for each pointer returned by GetText()\r
-    * to avoid possible memory leaks.\r
-    */\r
-   uchar* GetText(DocID d) const {\r
-     return Text->GetText(d);\r
-   }\r
-\r
-   /**\r
-    * Free the pointer returned by GetText().\r
-    */\r
-   void DeleteText(uchar *text) const {\r
-       Text->DeleteText(text);\r
+    * id d. */\r
+   uchar* GetText(DocID d) {\r
+     uchar * s = Text->GetText(d);\r
+     return (s[0] == 1 ? (uchar*)"" : s);\r
    }\r
 \r
    /** GetText(i, j): returns the texts corresponding to documents with\r
-    * ids i, i+1, ..., j. Texts are separated by '\0' character.  \r
-    *\r
-    * Call DeleteText() for each pointer returned by GetText()\r
-    * to avoid possible memory leaks.\r
-    */\r
-   uchar* GetText(DocID i, DocID j) const {\r
-     return Text->GetText(i, j);\r
-   }\r
-\r
+    * ids i, i+1, ..., j. Texts are separated by '\0' character.  */\r
+   //   uchar* GetText(DocID i, DocID j) {\r
+   //  uchar * s = Text->GetText(i, j);\r
+   // return (s[0] == 1 ? (uchar*)"" : s);\r
+   //}\r
 \r
    TextCollection *getTextCollection() {\r
       return Text;\r
@@ -442,6 +412,10 @@ public:
    void insertTag(TagType tag, uint position);\r
    \r
    void print_stats();\r
+\r
+   treeNode Closing(treeNode x);\r
+   bool IsOpen(treeNode x);\r
+\r
 };\r
 #endif\r
 \r