Added support for char arrays
authornvalimak <nvalimak@3cdefd35-fc62-479d-8e8d-bae585ffb9ca>
Tue, 10 Mar 2009 19:10:25 +0000 (19:10 +0000)
committernvalimak <nvalimak@3cdefd35-fc62-479d-8e8d-bae585ffb9ca>
Tue, 10 Mar 2009 19:10:25 +0000 (19:10 +0000)
git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/XMLTree@239 3cdefd35-fc62-479d-8e8d-bae585ffb9ca

libcds/src/static_sequence/wt_node_leaf.cpp
libcds/src/static_sequence/wt_node_leaf.h

index d99ea62..02bc9cc 100644 (file)
@@ -36,6 +36,23 @@ uint wt_node_leaf::rank(uint symbol, uint pos, uint l, wt_coder * c) {
        return pos;
 }
 
+uint wt_node_leaf::rankLessThan(uint &symbol, uint pos, uint l, wt_coder * c) {
+//    std::cout <<"this-symbol: " << (uchar)this->symbol << ", symbol = " << (uchar)symbol << ", pos = " << pos << std::endl;
+       if(symbol > this->symbol) return -1;
+        symbol = this->symbol;
+       pos++;
+       return pos;
+}
+
+uint wt_node_leaf::rankLessThan(uint &symbol, uint pos) {
+//    std::cout <<"this-symbol: " << (uchar)this->symbol << ", symbol = " << (uchar)symbol << ", pos = " << pos << std::endl;
+    if (pos == -1)
+        return -1;
+    symbol = this->symbol;
+    pos++;
+    return pos;
+}
+
 uint wt_node_leaf::select(uint symbol, uint pos, uint l, wt_coder * c) {
        if(symbol!=this->symbol) return (uint)-1;
        if(pos==0 || pos>count) return (uint)-1;
@@ -43,6 +60,8 @@ uint wt_node_leaf::select(uint symbol, uint pos, uint l, wt_coder * c) {
 }
 
 uint wt_node_leaf::access(uint pos) {
+//   std::cout <<"this-symbol: " << (uchar)this->symbol << ", pos = " << pos << std::endl;
+
        return symbol;
 }
 
index b8ff85e..39f02d1 100644 (file)
@@ -36,6 +36,8 @@ class wt_node_leaf: public wt_node {
                wt_node_leaf(uint symbol, uint count);
                virtual ~wt_node_leaf();
                virtual uint rank(uint symbol, uint pos, uint l, wt_coder * c);
+               virtual uint rankLessThan(uint &symbol, uint pos, uint level, wt_coder * c);
+               virtual uint rankLessThan(uint &symbol, uint pos);
                virtual uint select(uint symbol, uint pos, uint l, wt_coder * c);
                virtual uint access(uint pos);
                virtual uint size();