Code clean up.
[SXSI/XMLTree.git] / libcds / src / static_sequence / wt_node_leaf.cpp
index f712f85..9d15193 100644 (file)
@@ -36,17 +36,9 @@ 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 == (uint)-1)
+    if (pos == (uint)-1 || symbol < this->symbol)
         return -1;
     symbol = this->symbol;
     pos++;
@@ -65,6 +57,36 @@ uint wt_node_leaf::access(uint pos) {
        return symbol;
 }
 
+uint wt_node_leaf::access(uint pos, uint &rank) {
+    rank = pos+1;
+    return symbol;
+}
+
+void wt_node_leaf::access(vector<int> &result, uint i, uint j, uint min, uint max, uint l, uint pivot)
+{
+//    std::cout << "At l = " << l << ", [" << i << ", " << j  << "], [" << min << ", " << max << "], symbol = " << symbol << std::endl;
+    
+    if (i <= j && symbol >= min && symbol <= max)
+        result.push_back((int)symbol);
+}
+
+void wt_node_leaf::access(vector<int> &result, uint i, uint j)
+{
+//    std::cout << "At l = " << l << ", [" << i << ", " << j  << "], [" << min << ", " << max << "], symbol = " << symbol << std::endl;
+    
+    if (i <= j)
+        result.push_back((int)symbol);
+}
+
+uint wt_node_leaf::access(uint i, uint j, uint min, uint max, uint l, uint pivot)
+{
+//    std::cout << "At l = " << l << ", [" << i << ", " << j  << "], [" << min << ", " << max << "], symbol = " << symbol << std::endl;
+    
+    if (i <= j && symbol >= min && symbol <= max)
+        return 1;
+    return 0;
+}
+
 uint wt_node_leaf::size() {
        return sizeof(wt_node_leaf);
 }