Mobios v0.91

mobios.index
Class AbstractIndex

java.lang.Object
  extended by mobios.index.AbstractIndex
All Implemented Interfaces:
Serializable, Index
Direct Known Subclasses:
VPIndex

public abstract class AbstractIndex
extends Object
implements Index

The primary interface for a distance-based index. Through AbstractIndex, the user can build a database index, or read a pre-built index from a file, and then do the search.

Version:
2006.07.24
Author:
Rui Mao, Willard
See Also:
Serialized Form

Constructor Summary
AbstractIndex(File mobiosDataDir, String fileName, List<? extends IndexObject> data, Metric metric, Level debugLevel)
          The constructor in common use.
 
Method Summary
 void close()
          Closes anything used internally that needs to be closed.
 void destroy()
          Deletes the index from the file, and also release it from memory.
 List<IndexObject> getAllPoints()
          Returns all the data points in the index
 Metric getMetric()
           
 void initAndOpenOIOM(File dir, boolean readOnly)
          Initializes and opens the ObjectIOManager for this index.
 void preLoad(int level)
          When a lot of queries are to be answered, for the sake of performance, it is a good idea to have the top levels of the index tree reside in memory.
 int size()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface mobios.index.Index
getOIOM, getRootAddress, search
 

Constructor Detail

AbstractIndex

public AbstractIndex(File mobiosDataDir,
                     String fileName,
                     List<? extends IndexObject> data,
                     Metric metric,
                     Level debugLevel)
The constructor in common use. Initializes the directory to store index files, opens up the ObjectIOManager, and defines the metric and debug level to use when building an index.

Parameters:
fileName -
data -
metric -
debugLevel -
Method Detail

initAndOpenOIOM

public void initAndOpenOIOM(File dir,
                            boolean readOnly)
Initializes and opens the ObjectIOManager for this index.

Parameters:
readOnly -

getMetric

public Metric getMetric()
Specified by:
getMetric in interface Index
Returns:
the metric used to build the index.

size

public int size()
Specified by:
size in interface Index
Returns:
the total number of data objects contained in the index.

preLoad

public void preLoad(int level)
Description copied from interface: Index
When a lot of queries are to be answered, for the sake of performance, it is a good idea to have the top levels of the index tree reside in memory. This method loads the top levels into memory.

Specified by:
preLoad in interface Index
Parameters:
level - number of levels, from the root, to be pre-loaded into memory.

getAllPoints

public List<IndexObject> getAllPoints()
Description copied from interface: Index
Returns all the data points in the index

Specified by:
getAllPoints in interface Index

close

public void close()
           throws IOException
Description copied from interface: Index
Closes anything used internally that needs to be closed. It is a good idea to close it when it is no longer in use.

Specified by:
close in interface Index
Throws:
IOException

destroy

public void destroy()
             throws IOException
Description copied from interface: Index
Deletes the index from the file, and also release it from memory. This method should only be called when the index will never be used again!

Specified by:
destroy in interface Index
Throws:
IOException

Mobios v0.91

(C) 2002 - 2006 The MoBIoS Group