package core.index;
import java.util.List;

import core.index.key.MDIndexKey;


/**
 * 
 * An API for implementing multi-dimensional index, e.g. R-Tree, K-d Tree, etc.
 * 
 */

public interface MDIndex {

	/*
	 * Placeholder class for the index leaves.
	 * 
	 */
	public static class Bucket{
		int bucketId;
	}
	
	
	public MDIndex clone() throws CloneNotSupportedException;
	
	
	/*
	 * 
	 * The Build phase of the index
	 * 
	 */
	
	
	/**
	 * Initialize the index with the number of dimensions and 
	 * the maximum number of buckets over those dimensions.
	 * 
	 * @param dimensions
	 * @param bucketSize
	 */
	public void initBuild(int bucketSize); 

	
	/**
	 * Insert an entry into the index structure (internal nodes).
	 * This method does not load the actual data into the index.
	 * 
	 * @param key
	 */
	public void insert(MDIndexKey key);
	

	/**
	 * Bulk load the index structure, without loading the actual data.
	 * 
	 * TODO: this method does not really fit in our project because it 
	 * assumes data to be in memory.
	 * 
	 * @param keys
	 */
	public void bulkLoad(MDIndexKey[] keys);
	
	
	
	/*
	 * 
	 * The Probe phase of the index
	 * 
	 */
	
	
	public void initProbe();
	
	/**
	 * Get the bucket id, for a given key, from an existing index.
	 * 
	 * @param key
	 * @return
	 */
	public Object getBucketId(MDIndexKey key);
	
	
	/**
	 * Point query.
	 * 
	 * @param key
	 * @return the bucket containing the key.
	 */
	public Bucket search(MDIndexKey key);
	
	
	/**
	 * Range query.
	 * 
	 * @param low
	 * @param high
	 * @return the set of buckets containing the given range.
	 */
	public List<Bucket> range(MDIndexKey low, MDIndexKey high);
	
	
	/*
	 * 
	 * Other Utility methods.
	 * 
	 */
	
	/**
	 * Serialize the index into a byte array.
	 * 
	 * @return serialized index.
	 */
	public byte[] marshall();
	
	
	/**
	 * Deserialize the index from a byte array.
	 * 
	 * @param bytes
	 */
	public void unmarshall(byte[] bytes);
	
}

@@ -465,42 +465,8 @@
 with
- the number of dimensions and %0A%09 *
  the
@@ -495,36 +495,13 @@
 kets
- over those dimensions
 .%0A%09 *
- 
 %0A%09 *
@@ -512,40 +512,19 @@
 ram 
-dimensions%0A%09 * @param b
+numB
 ucket
-Size
+s;
 %0A%09 *
@@ -556,21 +556,20 @@
 int 
-b
+numB
 ucket
-Size
+s
 );
- 
 %0A%0A%09%0A

Change bucketSize to numBuckets