Added LessThan() implementation
[SXSI/TextCollection.git] / TextCollection.h
index e7e36e2..37d5cb5 100644 (file)
@@ -56,14 +56,16 @@ namespace SXSI
          * New samplerate can be given, otherwise will use the one specified in the save file!
          * Note: This is not a static method; call InitTextCollection() first to get the object handle.
          *
-         * Throws an exception if something goes wrong (unlikely since we are passing a file descriptor).
+         * Throws an exception if std::fread() fails.
          * 
          */
         virtual void Load(FILE *, unsigned samplerate = 0) = 0;
         /**
          * Save data structure into a file
+         * 
+         * Throws an exception if std::fwrite() fails.
          */
-        virtual void Save(FILE *) = 0;
+        virtual void Save(FILE *) const = 0;
         /**
          * Virtual destructor
          */
@@ -84,7 +86,13 @@ namespace SXSI
          * New texts can not be inserted after this operation.
          */
         virtual void MakeStatic() = 0;
-        
+       
+       /**
+          tests if the string pointed to by DocId is empty
+        */
+       
+       virtual bool EmptyText(DocId) const = 0;
+
         /**
          * Displaying content
          *
@@ -97,13 +105,13 @@ namespace SXSI
          *
          * Note: Parameters i and j are text positions inside the k'th text.
          */
-        virtual uchar* GetText(DocId, TextPosition, TextPosition) const = 0;
+//        virtual uchar* GetText(DocId, TextPosition, TextPosition) const = 0;
         /**
          * Returns backwards (reverse) iterator to the end of i'th text
          * 
          * Note: Do we need this?
          * Forward iterator would be really in-efficient compared to
-         * getText(k) and getText(k, i, j).
+         * getText(k).
          *
          * TODO Define and implement const_reverse_iterator.
          */
@@ -124,8 +132,12 @@ namespace SXSI
         virtual bool IsLessThan(uchar const *) const = 0;
 
         /**
-         * Counting queries 
-         * 
+         * Counting queries
+         * Result is the number of occurrences.
+         */
+        virtual ulong Count(uchar const *) const = 0;
+        /**
+         * More counting queries
          * Result is the number of documents.
          */
         virtual unsigned CountPrefix(uchar const *) const = 0;