From a01a06472c8dcf1c58a8d87e6b93eb709b921d0e Mon Sep 17 00:00:00 2001 From: nvalimak Date: Tue, 10 Mar 2009 19:10:25 +0000 Subject: [PATCH] Added support for char arrays 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 | 19 +++++++++++++++++++ libcds/src/static_sequence/wt_node_leaf.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/libcds/src/static_sequence/wt_node_leaf.cpp b/libcds/src/static_sequence/wt_node_leaf.cpp index d99ea62..02bc9cc 100644 --- a/libcds/src/static_sequence/wt_node_leaf.cpp +++ b/libcds/src/static_sequence/wt_node_leaf.cpp @@ -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; } diff --git a/libcds/src/static_sequence/wt_node_leaf.h b/libcds/src/static_sequence/wt_node_leaf.h index b8ff85e..39f02d1 100644 --- a/libcds/src/static_sequence/wt_node_leaf.h +++ b/libcds/src/static_sequence/wt_node_leaf.h @@ -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(); -- 2.17.1