finished initial btree code cleaning

git-svn-id: https://hyracks.googlecode.com/svn/trunk@97 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IComparator.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IComparator.java
deleted file mode 100644
index 8b6e9eb..0000000
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IComparator.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2009-2010 by The Regents of the University of California
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * you may obtain a copy of the License from
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package edu.uci.ics.hyracks.storage.am.btree.api;
-
-public interface IComparator {		
-	public int compare(byte[] dataA, int recOffA, byte[] dataB, int recOffB);
-}
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IFrameCompressor.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IFrameCompressor.java
index efd6510..dd981c1 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IFrameCompressor.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IFrameCompressor.java
@@ -15,9 +15,9 @@
 
 package edu.uci.ics.hyracks.storage.am.btree.api;
 
-import edu.uci.ics.hyracks.storage.am.btree.frames.FieldPrefixNSMLeaf;
+import edu.uci.ics.hyracks.storage.am.btree.frames.FieldPrefixNSMLeafFrame;
 import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
 
 public interface IFrameCompressor {
-	public boolean compress(FieldPrefixNSMLeaf frame, MultiComparator cmp) throws Exception;
+	public boolean compress(FieldPrefixNSMLeafFrame frame, MultiComparator cmp) throws Exception;
 }
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IPrefixSlotManager.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IPrefixSlotManager.java
index 9a8a050..3599933 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IPrefixSlotManager.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/api/IPrefixSlotManager.java
@@ -17,7 +17,7 @@
 
 import java.nio.ByteBuffer;
 
-import edu.uci.ics.hyracks.storage.am.btree.frames.FieldPrefixNSMLeaf;
+import edu.uci.ics.hyracks.storage.am.btree.frames.FieldPrefixNSMLeafFrame;
 import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
 
 // a slot consists of two fields:
@@ -41,7 +41,7 @@
 // all prefixes are recomputed during a reorg or compaction
 
 public interface IPrefixSlotManager {
-	public void setFrame(FieldPrefixNSMLeaf frame);
+	public void setFrame(FieldPrefixNSMLeafFrame frame);
 	
 	public int decodeFirstSlotField(int slot);
 	public int decodeSecondSlotField(int slot);		
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/compressors/FieldPrefixCompressor.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/compressors/FieldPrefixCompressor.java
index 6ac5c7e..27a8952 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/compressors/FieldPrefixCompressor.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/compressors/FieldPrefixCompressor.java
@@ -24,7 +24,7 @@
 import edu.uci.ics.hyracks.storage.am.btree.api.IFieldAccessor;
 import edu.uci.ics.hyracks.storage.am.btree.api.IFrameCompressor;
 import edu.uci.ics.hyracks.storage.am.btree.api.IPrefixSlotManager;
-import edu.uci.ics.hyracks.storage.am.btree.frames.FieldPrefixNSMLeaf;
+import edu.uci.ics.hyracks.storage.am.btree.frames.FieldPrefixNSMLeafFrame;
 import edu.uci.ics.hyracks.storage.am.btree.impls.FieldIterator;
 import edu.uci.ics.hyracks.storage.am.btree.impls.FieldPrefixSlotManager;
 import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
@@ -43,7 +43,7 @@
 	}
 	
 	@Override
-	public boolean compress(FieldPrefixNSMLeaf frame, MultiComparator cmp) throws Exception {		
+	public boolean compress(FieldPrefixNSMLeafFrame frame, MultiComparator cmp) throws Exception {		
 		int numRecords = frame.getNumRecords();
     	if(numRecords <= 0) {
             frame.setNumPrefixRecords(0);
@@ -299,7 +299,7 @@
     // i.e., all records in a keypartition will be compressed based on the same prefix length (number of fields)
     // the prefix length may be different for different keypartitions
     // the occurrenceThreshold determines the minimum number of records that must share a common prefix in order for us to consider compressing them        
-    private ArrayList<KeyPartition> getKeyPartitions(FieldPrefixNSMLeaf frame, MultiComparator cmp, int occurrenceThreshold) {        
+    private ArrayList<KeyPartition> getKeyPartitions(FieldPrefixNSMLeafFrame frame, MultiComparator cmp, int occurrenceThreshold) {        
     	IBinaryComparator[] cmps = cmp.getComparators();
         IFieldAccessor[] fields = cmp.getFields();
         
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeaf.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeafFrame.java
similarity index 98%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeaf.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeafFrame.java
index c8f4b25..7627055 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeaf.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeafFrame.java
@@ -36,7 +36,7 @@
 import edu.uci.ics.hyracks.storage.am.btree.impls.SplitKey;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
-public class FieldPrefixNSMLeaf implements IBTreeLeafFrame {
+public class FieldPrefixNSMLeafFrame implements IBTreeLeafFrame {
 	
     protected static final int pageLsnOff = 0;                              // 0
     protected static final int numRecordsOff = pageLsnOff + 4;              // 4    
@@ -55,7 +55,7 @@
     public IFrameCompressor compressor;
     public IPrefixSlotManager slotManager; // TODO: should be protected, but will trigger some refactoring
     
-    public FieldPrefixNSMLeaf() {
+    public FieldPrefixNSMLeafFrame() {
         this.slotManager = new FieldPrefixSlotManager();
         this.compressor = new FieldPrefixCompressor(0.001f, 2);        
     }
@@ -441,7 +441,7 @@
     @Override
     public int split(IBTreeFrame rightFrame, byte[] data, MultiComparator cmp, SplitKey splitKey) throws Exception {
     	    	
-    	FieldPrefixNSMLeaf rf = (FieldPrefixNSMLeaf)rightFrame;
+    	FieldPrefixNSMLeafFrame rf = (FieldPrefixNSMLeafFrame)rightFrame;
     	
     	// before doing anything check if key already exists
 		int slot = slotManager.findSlot(data, cmp, true);
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeafFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeafFrameFactory.java
similarity index 87%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeafFactory.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeafFrameFactory.java
index 8b4521a..33beaeb 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeafFactory.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/FieldPrefixNSMLeafFrameFactory.java
@@ -18,9 +18,9 @@
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrame;
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrameFactory;
 
-public class FieldPrefixNSMLeafFactory implements IBTreeLeafFrameFactory {
+public class FieldPrefixNSMLeafFrameFactory implements IBTreeLeafFrameFactory {
 	@Override
 	public IBTreeLeafFrame getFrame() {		
-		return new FieldPrefixNSMLeaf();
+		return new FieldPrefixNSMLeafFrame();
 	}
 }
\ No newline at end of file
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeMeta.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/MetaDataFrame.java
similarity index 98%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeMeta.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/MetaDataFrame.java
index 44f7f1c..6a479b0 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeMeta.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/MetaDataFrame.java
@@ -25,7 +25,7 @@
 // the first meta page is special because it guarantees to have a correct max page
 // other meta pages (i.e., with level -2) have junk in the max page field
 
-public class BTreeMeta implements IBTreeMetaDataFrame {
+public class MetaDataFrame implements IBTreeMetaDataFrame {
         
     protected static final int numRecordsOff = 0;             
     protected static final int freeSpaceOff = numRecordsOff + 4;
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeMetaFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/MetaDataFrameFactory.java
similarity index 89%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeMetaFactory.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/MetaDataFrameFactory.java
index 01058c9..d11a920 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeMetaFactory.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/MetaDataFrameFactory.java
@@ -18,9 +18,9 @@
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeMetaDataFrame;
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeMetaDataFrameFactory;
 
-public class BTreeMetaFactory implements IBTreeMetaDataFrameFactory {
+public class MetaDataFrameFactory implements IBTreeMetaDataFrameFactory {
     @Override
     public IBTreeMetaDataFrame getFrame() {     
-        return new BTreeMeta();
+        return new MetaDataFrame();
     }   
 }
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSM.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMFrame.java
similarity index 98%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSM.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMFrame.java
index a4978a8..20a3e19 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSM.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMFrame.java
@@ -28,7 +28,7 @@
 import edu.uci.ics.hyracks.storage.am.btree.impls.SpaceStatus;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 
-public abstract class BTreeNSM implements IBTreeFrame {
+public abstract class NSMFrame implements IBTreeFrame {
 	
 	protected static final int pageLsnOff = 0;								// 0
 	protected static final int numRecordsOff = pageLsnOff + 4;				// 4
@@ -41,7 +41,7 @@
 	protected ByteBuffer buf = null;
 	protected ISlotManager slotManager;
 	
-	public BTreeNSM() {
+	public NSMFrame() {
 		this.slotManager = new OrderedSlotManager();
 	}
 	
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMInterior.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMInteriorFrame.java
similarity index 98%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMInterior.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMInteriorFrame.java
index f48a751..773400a 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMInterior.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMInteriorFrame.java
@@ -27,13 +27,13 @@
 import edu.uci.ics.hyracks.storage.am.btree.impls.SlotOffRecOff;
 import edu.uci.ics.hyracks.storage.am.btree.impls.SplitKey;
 
-public class BTreeNSMInterior extends BTreeNSM implements IBTreeInteriorFrame {
+public class NSMInteriorFrame extends NSMFrame implements IBTreeInteriorFrame {
 		
 	private static final int rightLeafOff = smFlagOff + 1;
 	
 	private static final int childPtrSize = 4;
 	
-	public BTreeNSMInterior() {
+	public NSMInteriorFrame() {
 		super();
 	}
 	
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMInteriorFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMInteriorFrameFactory.java
similarity index 90%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMInteriorFactory.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMInteriorFrameFactory.java
index 1674554..f772761 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMInteriorFactory.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMInteriorFrameFactory.java
@@ -18,9 +18,9 @@
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeInteriorFrame;
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeInteriorFrameFactory;
 
-public class BTreeNSMInteriorFactory implements IBTreeInteriorFrameFactory {
+public class NSMInteriorFrameFactory implements IBTreeInteriorFrameFactory {
 	@Override
 	public IBTreeInteriorFrame getFrame() {		
-		return new BTreeNSMInterior();
+		return new NSMInteriorFrame();
 	}	
 }
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeaf.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMLeafFrame.java
similarity index 97%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeaf.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMLeafFrame.java
index da0d52a..3d51f05c 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeaf.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMLeafFrame.java
@@ -23,11 +23,11 @@
 import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
 import edu.uci.ics.hyracks.storage.am.btree.impls.SplitKey;
 
-public class BTreeNSMLeaf extends BTreeNSM implements IBTreeLeafFrame {    
+public class NSMLeafFrame extends NSMFrame implements IBTreeLeafFrame {    
 	protected static final int prevLeafOff = smFlagOff + 1;
 	protected static final int nextLeafOff = prevLeafOff + 4;
 	
-	public BTreeNSMLeaf() {
+	public NSMLeafFrame() {
 		super();
 	}
 	
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeafFactory.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMLeafFrameFactory.java
similarity index 90%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeafFactory.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMLeafFrameFactory.java
index 557d8ca..7ef1c8f 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeafFactory.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/NSMLeafFrameFactory.java
@@ -18,9 +18,9 @@
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrame;
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrameFactory;
 
-public class BTreeNSMLeafFactory implements IBTreeLeafFrameFactory {
+public class NSMLeafFrameFactory implements IBTreeLeafFrameFactory {
 	@Override
 	public IBTreeLeafFrame getFrame() {		
-		return new BTreeNSMLeaf();
+		return new NSMLeafFrame();
 	}
 }
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
index 5453409..f1353b1 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
@@ -27,7 +27,7 @@
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrame;
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeLeafFrameFactory;
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeMetaDataFrame;
-import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMInterior;
+import edu.uci.ics.hyracks.storage.am.btree.frames.NSMInteriorFrame;
 import edu.uci.ics.hyracks.storage.common.buffercache.IBufferCache;
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 import edu.uci.ics.hyracks.storage.common.file.FileInfo;
@@ -324,7 +324,7 @@
             System.out.format(keyString);
             
             if (!interiorFrame.isLeaf()) {
-                ArrayList<Integer> children = ((BTreeNSMInterior) (interiorFrame)).getChildren(cmp);
+                ArrayList<Integer> children = ((NSMInteriorFrame) (interiorFrame)).getChildren(cmp);
                 for (int i = 0; i < children.size(); i++) {
                     printTree(children.get(i), node, i == children.size() - 1, leafFrame, interiorFrame);
                 }
@@ -344,7 +344,7 @@
         }
     }
 
-    public void diskOrderScan(BTreeDiskOrderScanCursor cursor, IBTreeLeafFrame leafFrame, IBTreeMetaDataFrame metaFrame) throws Exception {
+    public void diskOrderScan(DiskOrderScanCursor cursor, IBTreeLeafFrame leafFrame, IBTreeMetaDataFrame metaFrame) throws Exception {
         int currentPageId = rootPage + 1;
         int maxPageId = -1;
         
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeDiskOrderScanCursor.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/DiskOrderScanCursor.java
similarity index 97%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeDiskOrderScanCursor.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/DiskOrderScanCursor.java
index ecb95fe..441ea02 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeDiskOrderScanCursor.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/DiskOrderScanCursor.java
@@ -22,7 +22,7 @@
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 import edu.uci.ics.hyracks.storage.common.file.FileInfo;
 
-public class BTreeDiskOrderScanCursor implements IBTreeCursor {
+public class DiskOrderScanCursor implements IBTreeCursor {
     
     // TODO: might want to return records in physical order, not logical order to speed up access
     
@@ -35,7 +35,7 @@
     private IBTreeLeafFrame frame = null;
     private IBufferCache bufferCache = null;
     
-    public BTreeDiskOrderScanCursor(IBTreeLeafFrame frame) {
+    public DiskOrderScanCursor(IBTreeLeafFrame frame) {
         this.frame = frame;
     }
     
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/FieldIterator.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/FieldIterator.java
index bd99226..8132199 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/FieldIterator.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/FieldIterator.java
@@ -16,7 +16,7 @@
 package edu.uci.ics.hyracks.storage.am.btree.impls;
 
 import edu.uci.ics.hyracks.storage.am.btree.api.IFieldAccessor;
-import edu.uci.ics.hyracks.storage.am.btree.frames.FieldPrefixNSMLeaf;
+import edu.uci.ics.hyracks.storage.am.btree.frames.FieldPrefixNSMLeafFrame;
 
 //TODO: make members private, only for debugging now
 public class FieldIterator {
@@ -25,17 +25,17 @@
     public int prefixSlotNum = FieldPrefixSlotManager.RECORD_UNCOMPRESSED;
     public int numPrefixFields = 0;
     public IFieldAccessor[] fields;
-    public FieldPrefixNSMLeaf frame;
+    public FieldPrefixNSMLeafFrame frame;
     
     public int currentField = -1;
     public int recOffRunner = -1;
     
-    public FieldIterator(IFieldAccessor[] fields, FieldPrefixNSMLeaf frame) {
+    public FieldIterator(IFieldAccessor[] fields, FieldPrefixNSMLeafFrame frame) {
         this.fields = fields;
         this.frame = frame;
     }
     
-    public void setFrame(FieldPrefixNSMLeaf frame) {
+    public void setFrame(FieldPrefixNSMLeafFrame frame) {
         this.frame = frame;        
     }
     
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/FieldPrefixSlotManager.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/FieldPrefixSlotManager.java
index 3b12e6f..de4c913 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/FieldPrefixSlotManager.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/FieldPrefixSlotManager.java
@@ -19,7 +19,7 @@
 
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
 import edu.uci.ics.hyracks.storage.am.btree.api.IPrefixSlotManager;
-import edu.uci.ics.hyracks.storage.am.btree.frames.FieldPrefixNSMLeaf;
+import edu.uci.ics.hyracks.storage.am.btree.frames.FieldPrefixNSMLeafFrame;
 
 public class FieldPrefixSlotManager implements IPrefixSlotManager {
 	
@@ -29,7 +29,7 @@
 	public static final int GREATEST_SLOT = 0x00FFFFFF;
 	
 	private ByteBuffer buf;
-	private FieldPrefixNSMLeaf frame;
+	private FieldPrefixNSMLeafFrame frame;
 	FieldIterator fieldIter = new FieldIterator(null, null);
 	
 	public int decodeFirstSlotField(int slot) {
@@ -220,7 +220,7 @@
 		}
 	}
 	
-	public void setFrame(FieldPrefixNSMLeaf frame) {
+	public void setFrame(FieldPrefixNSMLeafFrame frame) {
 		this.frame = frame;
 		this.buf = frame.getBuffer();
 	}
diff --git a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeRangeSearchCursor.java b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/RangeSearchCursor.java
similarity index 97%
rename from hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeRangeSearchCursor.java
rename to hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/RangeSearchCursor.java
index 6ccdf16..99784bc 100644
--- a/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeRangeSearchCursor.java
+++ b/hyracks/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/RangeSearchCursor.java
@@ -22,7 +22,7 @@
 import edu.uci.ics.hyracks.storage.common.buffercache.ICachedPage;
 import edu.uci.ics.hyracks.storage.common.file.FileInfo;
 
-public class BTreeRangeSearchCursor implements IBTreeCursor {
+public class RangeSearchCursor implements IBTreeCursor {
 
 	private ISearchPredicate searchPred = null;	
 	private int recordNum = 0;
@@ -32,7 +32,7 @@
 	private IBTreeLeafFrame frame = null;
 	private IBufferCache bufferCache = null;
 	
-	public BTreeRangeSearchCursor(IBTreeLeafFrame frame) {
+	public RangeSearchCursor(IBTreeLeafFrame frame) {
 		this.frame = frame;		
 	}
 	
diff --git a/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeFieldPrefixNSMTest.java b/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeFieldPrefixNSMTest.java
index 05a929d..a4d5095 100644
--- a/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeFieldPrefixNSMTest.java
+++ b/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeFieldPrefixNSMTest.java
@@ -31,7 +31,7 @@
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
 import edu.uci.ics.hyracks.storage.am.btree.api.IFieldAccessor;
 import edu.uci.ics.hyracks.storage.am.btree.api.IPrefixSlotManager;
-import edu.uci.ics.hyracks.storage.am.btree.frames.FieldPrefixNSMLeaf;
+import edu.uci.ics.hyracks.storage.am.btree.frames.FieldPrefixNSMLeafFrame;
 import edu.uci.ics.hyracks.storage.am.btree.impls.FieldPrefixSlotManager;
 import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
 import edu.uci.ics.hyracks.storage.am.btree.types.Int32Accessor;
@@ -73,7 +73,7 @@
         }
     }
     
-    private void tupleInsert(FieldPrefixNSMLeaf frame, MultiComparator cmp, int f0, int f1, int f2, boolean print, ArrayList<byte[]> records) throws Exception {
+    private void tupleInsert(FieldPrefixNSMLeafFrame frame, MultiComparator cmp, int f0, int f1, int f2, boolean print, ArrayList<byte[]> records) throws Exception {
     	if(print) System.out.println("INSERTING: " + f0 + " " + f1 + " " + f2);
     	
     	ByteArrayAccessibleOutputStream baaos = new ByteArrayAccessibleOutputStream();
@@ -123,7 +123,7 @@
         try {
         	        	        	        	
             IPrefixSlotManager slotManager = new FieldPrefixSlotManager();
-            FieldPrefixNSMLeaf frame = new FieldPrefixNSMLeaf();                                    
+            FieldPrefixNSMLeafFrame frame = new FieldPrefixNSMLeafFrame();                                    
             frame.setPage(page);            
             frame.initBuffer((byte)0);
             slotManager.setFrame(frame);          
diff --git a/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeTest.java b/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeTest.java
index e5bc1b6..b1bec61 100644
--- a/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeTest.java
+++ b/hyracks/hyracks-storage-am-btree/src/test/java/edu/uci/ics/hyracks/storage/am/btree/BTreeTest.java
@@ -37,12 +37,12 @@
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeMetaDataFrame;
 import edu.uci.ics.hyracks.storage.am.btree.api.IBTreeMetaDataFrameFactory;
 import edu.uci.ics.hyracks.storage.am.btree.api.IFieldAccessor;
-import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeMetaFactory;
-import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMInteriorFactory;
-import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMLeafFactory;
+import edu.uci.ics.hyracks.storage.am.btree.frames.MetaDataFrameFactory;
+import edu.uci.ics.hyracks.storage.am.btree.frames.NSMInteriorFrameFactory;
+import edu.uci.ics.hyracks.storage.am.btree.frames.NSMLeafFrameFactory;
 import edu.uci.ics.hyracks.storage.am.btree.impls.BTree;
-import edu.uci.ics.hyracks.storage.am.btree.impls.BTreeDiskOrderScanCursor;
-import edu.uci.ics.hyracks.storage.am.btree.impls.BTreeRangeSearchCursor;
+import edu.uci.ics.hyracks.storage.am.btree.impls.DiskOrderScanCursor;
+import edu.uci.ics.hyracks.storage.am.btree.impls.RangeSearchCursor;
 import edu.uci.ics.hyracks.storage.am.btree.impls.MultiComparator;
 import edu.uci.ics.hyracks.storage.am.btree.impls.RangePredicate;
 import edu.uci.ics.hyracks.storage.am.btree.types.Int32Accessor;
@@ -100,9 +100,9 @@
         FileInfo fi = new FileInfo(fileId, raf);
         fileManager.registerFile(fi);
         
-        IBTreeLeafFrameFactory leafFrameFactory = new BTreeNSMLeafFactory();
-        IBTreeInteriorFrameFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
-        IBTreeMetaDataFrameFactory metaFrameFactory = new BTreeMetaFactory();
+        IBTreeLeafFrameFactory leafFrameFactory = new NSMLeafFrameFactory();
+        IBTreeInteriorFrameFactory interiorFrameFactory = new NSMInteriorFrameFactory();
+        IBTreeMetaDataFrameFactory metaFrameFactory = new MetaDataFrameFactory();
         
         IBTreeLeafFrame leafFrame = leafFrameFactory.getFrame();
         IBTreeInteriorFrame interiorFrame = interiorFrameFactory.getFrame();
@@ -163,7 +163,7 @@
         
         // ordered scan
         print("ORDERED SCAN:\n");
-        IBTreeCursor scanCursor = new BTreeRangeSearchCursor(leafFrame);
+        IBTreeCursor scanCursor = new RangeSearchCursor(leafFrame);
         RangePredicate nullPred = new RangePredicate(true, null, null, null);
         btree.search(scanCursor, nullPred, leafFrame, interiorFrame);
         try {
@@ -182,7 +182,7 @@
         
         // disk-order scan
         print("DISK-ORDER SCAN:\n");        
-        BTreeDiskOrderScanCursor diskOrderCursor = new BTreeDiskOrderScanCursor(leafFrame);
+        DiskOrderScanCursor diskOrderCursor = new DiskOrderScanCursor(leafFrame);
         btree.diskOrderScan(diskOrderCursor, leafFrame, metaFrame);
         try {
             while (diskOrderCursor.hasNext()) {
@@ -201,7 +201,7 @@
         // range search in [-1000, 1000]
         print("RANGE SEARCH:\n");        
  
-        IBTreeCursor rangeCursor = new BTreeRangeSearchCursor(leafFrame);
+        IBTreeCursor rangeCursor = new RangeSearchCursor(leafFrame);
 
         ByteArrayAccessibleOutputStream lkbaaos = new ByteArrayAccessibleOutputStream();
     	DataOutputStream lkdos = new DataOutputStream(lkbaaos);    	    	    	
@@ -262,9 +262,9 @@
         FileInfo fi = new FileInfo(fileId, raf);
         fileManager.registerFile(fi);
                 
-        IBTreeLeafFrameFactory leafFrameFactory = new BTreeNSMLeafFactory();
-        IBTreeInteriorFrameFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
-        IBTreeMetaDataFrameFactory metaFrameFactory = new BTreeMetaFactory();
+        IBTreeLeafFrameFactory leafFrameFactory = new NSMLeafFrameFactory();
+        IBTreeInteriorFrameFactory interiorFrameFactory = new NSMInteriorFrameFactory();
+        IBTreeMetaDataFrameFactory metaFrameFactory = new MetaDataFrameFactory();
         
         IBTreeLeafFrame leafFrame = leafFrameFactory.getFrame();
         IBTreeInteriorFrame interiorFrame = interiorFrameFactory.getFrame();
@@ -322,7 +322,7 @@
         
         // try a simple index scan
         print("ORDERED SCAN:\n");        
-        IBTreeCursor scanCursor = new BTreeRangeSearchCursor(leafFrame);
+        IBTreeCursor scanCursor = new RangeSearchCursor(leafFrame);
         RangePredicate nullPred = new RangePredicate(true, null, null, null);
         btree.search(scanCursor, nullPred, leafFrame, interiorFrame);
         
@@ -342,7 +342,7 @@
 
         // range search in [(-3),(3)]
         print("RANGE SEARCH:\n");        
-        IBTreeCursor rangeCursor = new BTreeRangeSearchCursor(leafFrame);
+        IBTreeCursor rangeCursor = new RangeSearchCursor(leafFrame);
 
         ByteArrayAccessibleOutputStream lkbaaos = new ByteArrayAccessibleOutputStream();
     	DataOutputStream lkdos = new DataOutputStream(lkbaaos);    	    	    	
@@ -404,9 +404,9 @@
     	FileInfo fi = new FileInfo(fileId, raf);
     	fileManager.registerFile(fi);
     	
-        IBTreeLeafFrameFactory leafFrameFactory = new BTreeNSMLeafFactory();
-        IBTreeInteriorFrameFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
-        IBTreeMetaDataFrameFactory metaFrameFactory = new BTreeMetaFactory();
+        IBTreeLeafFrameFactory leafFrameFactory = new NSMLeafFrameFactory();
+        IBTreeInteriorFrameFactory interiorFrameFactory = new NSMInteriorFrameFactory();
+        IBTreeMetaDataFrameFactory metaFrameFactory = new MetaDataFrameFactory();
         
         IBTreeLeafFrame leafFrame = leafFrameFactory.getFrame();
         IBTreeInteriorFrame interiorFrame = interiorFrameFactory.getFrame();
@@ -454,7 +454,7 @@
 
     	// ordered scan
         print("ORDERED SCAN:\n");        
-        IBTreeCursor scanCursor = new BTreeRangeSearchCursor(leafFrame);
+        IBTreeCursor scanCursor = new RangeSearchCursor(leafFrame);
         RangePredicate nullPred = new RangePredicate(true, null, null, null);
         btree.search(scanCursor, nullPred, leafFrame, interiorFrame);
         
@@ -475,7 +475,7 @@
         // range search in ["cbf", cc7"]
         print("RANGE SEARCH:\n");        
         
-        IBTreeCursor rangeCursor = new BTreeRangeSearchCursor(leafFrame);
+        IBTreeCursor rangeCursor = new RangeSearchCursor(leafFrame);
                 
         ByteArrayAccessibleOutputStream lkbaaos = new ByteArrayAccessibleOutputStream();
     	DataOutputStream lkdos = new DataOutputStream(lkbaaos);    	    	    	
@@ -537,9 +537,9 @@
         FileInfo fi = new FileInfo(fileId, raf);
         fileManager.registerFile(fi);
                 
-        IBTreeLeafFrameFactory leafFrameFactory = new BTreeNSMLeafFactory();
-        IBTreeInteriorFrameFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
-        IBTreeMetaDataFrameFactory metaFrameFactory = new BTreeMetaFactory();
+        IBTreeLeafFrameFactory leafFrameFactory = new NSMLeafFrameFactory();
+        IBTreeInteriorFrameFactory interiorFrameFactory = new NSMInteriorFrameFactory();
+        IBTreeMetaDataFrameFactory metaFrameFactory = new MetaDataFrameFactory();
         
         IBTreeLeafFrame leafFrame = leafFrameFactory.getFrame();
         IBTreeInteriorFrame interiorFrame = interiorFrameFactory.getFrame();
@@ -658,9 +658,9 @@
         FileInfo fi = new FileInfo(fileId, raf);
         fileManager.registerFile(fi);
         
-        IBTreeLeafFrameFactory leafFrameFactory = new BTreeNSMLeafFactory();
-        IBTreeInteriorFrameFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
-        IBTreeMetaDataFrameFactory metaFrameFactory = new BTreeMetaFactory();
+        IBTreeLeafFrameFactory leafFrameFactory = new NSMLeafFrameFactory();
+        IBTreeInteriorFrameFactory interiorFrameFactory = new NSMInteriorFrameFactory();
+        IBTreeMetaDataFrameFactory metaFrameFactory = new MetaDataFrameFactory();
         
         IBTreeLeafFrame leafFrame = leafFrameFactory.getFrame();
         IBTreeInteriorFrame interiorFrame = interiorFrameFactory.getFrame();
@@ -719,7 +719,7 @@
         
         // range search
         print("RANGE SEARCH:\n");
-        IBTreeCursor rangeCursor = new BTreeRangeSearchCursor(leafFrame);
+        IBTreeCursor rangeCursor = new RangeSearchCursor(leafFrame);
         
         ByteArrayAccessibleOutputStream lkbaaos = new ByteArrayAccessibleOutputStream();
     	DataOutputStream lkdos = new DataOutputStream(lkbaaos);    	    	    	
@@ -779,9 +779,9 @@
         FileInfo fi = new FileInfo(fileId, raf);
         fileManager.registerFile(fi);       
                 
-        IBTreeLeafFrameFactory leafFrameFactory = new BTreeNSMLeafFactory();
-        IBTreeInteriorFrameFactory interiorFrameFactory = new BTreeNSMInteriorFactory();
-        IBTreeMetaDataFrameFactory metaFrameFactory = new BTreeMetaFactory();
+        IBTreeLeafFrameFactory leafFrameFactory = new NSMLeafFrameFactory();
+        IBTreeInteriorFrameFactory interiorFrameFactory = new NSMInteriorFrameFactory();
+        IBTreeMetaDataFrameFactory metaFrameFactory = new MetaDataFrameFactory();
         
         IBTreeLeafFrame leafFrame = leafFrameFactory.getFrame();
         IBTreeInteriorFrame interiorFrame = interiorFrameFactory.getFrame();
@@ -874,7 +874,7 @@
         // try a simple index scan
 
         print("ORDERED SCAN:\n");
-        IBTreeCursor scanCursor = new BTreeRangeSearchCursor(leafFrame);
+        IBTreeCursor scanCursor = new RangeSearchCursor(leafFrame);
         RangePredicate nullPred = new RangePredicate(true, null, null, null);
         btree.search(scanCursor, nullPred, leafFrame, interiorFrame);
 
@@ -894,7 +894,7 @@
 
         // try a range search
         print("RANGE SEARCH:\n");
-        IBTreeCursor rangeCursor = new BTreeRangeSearchCursor(leafFrame);
+        IBTreeCursor rangeCursor = new RangeSearchCursor(leafFrame);
 
         ByteArrayAccessibleOutputStream lkbaaos = new ByteArrayAccessibleOutputStream();
     	DataOutputStream lkdos = new DataOutputStream(lkbaaos);