directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r641993 - /directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
Date Thu, 27 Mar 2008 21:42:13 GMT
Author: akarasulu
Date: Thu Mar 27 14:42:12 2008
New Revision: 641993

URL: http://svn.apache.org/viewvc?rev=641993&view=rev
Log:
fixing bug where we need to use the value comparator rather than the key comparator

Modified:
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java?rev=641993&r1=641992&r2=641993&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
Thu Mar 27 14:42:12 2008
@@ -39,12 +39,12 @@
  */
 public class KeyTupleBTreeCursor<K,V> extends AbstractCursor<Tuple<K,V>>
 {
-    private final Comparator<K> comparator;
+    private final Comparator<V> comparator;
     private final BTree btree;
     private final K key;
 
     private jdbm.helper.Tuple valueTuple = new jdbm.helper.Tuple();
-    private Tuple returnedTuple = new Tuple();
+    private Tuple<K,V> returnedTuple = new Tuple<K,V>();
     private TupleBrowser browser;
     private boolean valueAvailable;
 
@@ -57,7 +57,7 @@
      * @param comparator the Comparator used to determine <b>key</b> ordering
      * @throws Exception of there are problems accessing the BTree
      */
-    public KeyTupleBTreeCursor( BTree btree, K key, Comparator<K> comparator ) throws
Exception
+    public KeyTupleBTreeCursor( BTree btree, K key, Comparator<V> comparator ) throws
Exception
     {
         this.key = key;
         this.btree = btree;
@@ -108,10 +108,10 @@
         while ( browser.getNext( valueTuple ) )
         {
             //noinspection unchecked
-            K next = ( K ) valueTuple.getKey();
+            V next = ( V ) valueTuple.getKey();
 
             //noinspection unchecked
-            int nextCompared = comparator.compare( next, element.getKey() );
+            int nextCompared = comparator.compare( next, element.getValue() );
 
             if ( nextCompared <= 0 )
             {
@@ -175,7 +175,7 @@
         if ( browser.getPrevious( valueTuple ) )
         {
             returnedTuple.setKey( key );
-            returnedTuple.setValue( valueTuple.getKey() );
+            returnedTuple.setValue( ( V ) valueTuple.getKey() );
             return valueAvailable = true;
         }
         else
@@ -191,7 +191,7 @@
         if ( browser.getNext( valueTuple ) )
         {
             returnedTuple.setKey( key );
-            returnedTuple.setValue( valueTuple.getKey() );
+            returnedTuple.setValue( ( V ) valueTuple.getKey() );
             return valueAvailable = true;
         }
         else



Mime
View raw message