activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r758732 - /activemq/trunk/kahadb/src/main/java/org/apache/kahadb/index/BTreeIndex.java
Date Thu, 26 Mar 2009 16:43:02 GMT
Author: chirino
Date: Thu Mar 26 16:42:52 2009
New Revision: 758732

URL: http://svn.apache.org/viewvc?rev=758732&view=rev
Log:
Added support for creating BTreeIndex objects with a default constructor.


Modified:
    activemq/trunk/kahadb/src/main/java/org/apache/kahadb/index/BTreeIndex.java

Modified: activemq/trunk/kahadb/src/main/java/org/apache/kahadb/index/BTreeIndex.java
URL: http://svn.apache.org/viewvc/activemq/trunk/kahadb/src/main/java/org/apache/kahadb/index/BTreeIndex.java?rev=758732&r1=758731&r2=758732&view=diff
==============================================================================
--- activemq/trunk/kahadb/src/main/java/org/apache/kahadb/index/BTreeIndex.java (original)
+++ activemq/trunk/kahadb/src/main/java/org/apache/kahadb/index/BTreeIndex.java Thu Mar 26
16:42:52 2009
@@ -18,10 +18,7 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
-import java.io.PrintStream;
 import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.Writer;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -31,7 +28,6 @@
 import org.apache.kahadb.page.Page;
 import org.apache.kahadb.page.PageFile;
 import org.apache.kahadb.page.Transaction;
-import org.apache.kahadb.page.Transaction.Closure;
 import org.apache.kahadb.util.Marshaller;
 
 /**
@@ -119,8 +115,8 @@
         }
     }    
 
-    private final PageFile pageFile;
-    private final long pageId;
+    private PageFile pageFile;
+    private long pageId;
     private AtomicBoolean loaded = new AtomicBoolean();
     
     private final BTreeNode.Marshaller<Key, Value> marshaller = new BTreeNode.Marshaller<Key,
Value>(this);
@@ -128,11 +124,24 @@
     private Marshaller<Value> valueMarshaller;
     private Prefixer<Key> prefixer;
 
+    public BTreeIndex() {
+    }
+
+    public BTreeIndex(long rootPageId) {
+        this.pageId = rootPageId;
+    }
+    
+    @SuppressWarnings("unchecked")
+    public BTreeIndex(Page page) {
+        this(page.getPageId());
+    }
+    
     public BTreeIndex(PageFile pageFile, long rootPageId) {
         this.pageFile = pageFile;
         this.pageId = rootPageId;
     }
 
+    @SuppressWarnings("unchecked")
     public BTreeIndex(PageFile pageFile, Page page) {
         this(pageFile, page.getPageId());
     }
@@ -309,4 +318,12 @@
         this.prefixer = prefixer;
     }
 
+    public void setPageFile(PageFile pageFile) {
+        this.pageFile = pageFile;
+    }
+
+    public void setPageId(long pageId) {
+        this.pageId = pageId;
+    }
+
 }



Mime
View raw message