Index
Class IndexInterface

java.lang.Object
  extended by Index.IndexInterface

public class IndexInterface
extends java.lang.Object

Implements the interface for managing indices.


Constructor Summary
IndexInterface(java.lang.String imageIndex, java.lang.String regionIndex)
          Basic constructor.
 
Method Summary
 boolean closeCursorImg()
          Closes an image cursor.
 boolean closeCursorsReg()
          Closes the region cursor.
 boolean createImageCursor(Document.Image i)
          Creates a cursor over a query image.
 boolean createIndex(boolean isImage, java.lang.String file, FeatureManager.FeatureManager fm)
          Creates a new index using feature stored in a DB.
 boolean createIndexBIN(boolean isImage, java.lang.String file)
          Creates a new index using feature stored in a DB.
 boolean createIndexTXT(boolean isImage, java.lang.String file, FeatureManager.FeatureManager fm)
          Creates the temporary text file to be used for creating an index.
 boolean createRegionCursors(Document.Image i)
          Creates cursors over regions of a query image.
 boolean deleteImage(Document.Image i)
          Deletes an image from the image index.
 boolean deleteRegion(Document.ImageID id, Document.Region r)
          Deletes a region from the region index.
 QueryProcessor.SF.ScoredResultImage getNextCursorsReg(int index)
          Retrieves the next result from a given region cursor.
 QueryProcessor.SF.ScoredResultImage getNextImageCursor()
          Retrieves the next result from an image cursor.
 IndexManager.ImgIndexManager imageIndexManager()
          Creates and returns a Manager for an image index.
 boolean insertNewImage(Document.Image i)
          Inserts a new image in the image index.
 boolean insertNewRegion(Document.ImageID id, Document.Region r)
          Inserts a new region in the region index.
 java.util.Vector<QueryProcessor.SF.ScoredResultImage> kNNImageQuery(Document.Image i, int k)
          Performs a k-NN query for a given image.
 java.util.Vector<QueryProcessor.SF.ScoredResultImage> kNNRegionQuery(Document.Region r, int k)
          Performs a k-NN query for a given region.
 java.util.Vector<QueryProcessor.SF.ScoredResultImage> rangeImageQuery(Document.Image i, double radius)
          Performs a range query for a given image.
 java.util.Vector<QueryProcessor.SF.ScoredResultImage> rangeQueryReg(Document.Region r, double radius)
          Performs a range query for a given region.
 IndexManager.RegIndexManager regionIndexManager()
          Creates and returns a Manager for a region index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexInterface

public IndexInterface(java.lang.String imageIndex,
                      java.lang.String regionIndex)
Basic constructor.

Parameters:
imageIndex - Path of image index.
regionIndex - Path of region index.
Method Detail

imageIndexManager

public IndexManager.ImgIndexManager imageIndexManager()
Creates and returns a Manager for an image index.

Returns:
A Manager for an image index.

regionIndexManager

public IndexManager.RegIndexManager regionIndexManager()
Creates and returns a Manager for a region index.

Returns:
A Manager for a region index.

kNNImageQuery

public java.util.Vector<QueryProcessor.SF.ScoredResultImage> kNNImageQuery(Document.Image i,
                                                                           int k)
Performs a k-NN query for a given image.

Parameters:
i - Query image.
k - Number of requested results.
Returns:
A vector of ScoredResultImages.

rangeImageQuery

public java.util.Vector<QueryProcessor.SF.ScoredResultImage> rangeImageQuery(Document.Image i,
                                                                             double radius)
Performs a range query for a given image.

Parameters:
i - Query image.
radius - Maximum distance value.
Returns:
A vector of ScoredResultImages.

kNNRegionQuery

public java.util.Vector<QueryProcessor.SF.ScoredResultImage> kNNRegionQuery(Document.Region r,
                                                                            int k)
Performs a k-NN query for a given region.

Parameters:
r - Query region.
k - Number of requested results.
Returns:
A vector of ScoredResultImages.

rangeQueryReg

public java.util.Vector<QueryProcessor.SF.ScoredResultImage> rangeQueryReg(Document.Region r,
                                                                           double radius)
Performs a range query for a given region.

Parameters:
r - Query region.
radius - Maximum distance value.
Returns:
A vector of ScoredResultImages.

createIndex

public boolean createIndex(boolean isImage,
                           java.lang.String file,
                           FeatureManager.FeatureManager fm)
Creates a new index using feature stored in a DB.

Parameters:
isImage - If true creates a image index, otherwise creates a region index.
file - Path of the temporary text file to be used for creating the index.
fm - Feature Manager for accessing features.
Returns:
true if the index was successfully created, false otherwise.

createIndexTXT

public boolean createIndexTXT(boolean isImage,
                              java.lang.String file,
                              FeatureManager.FeatureManager fm)
Creates the temporary text file to be used for creating an index.

Parameters:
isImage - If true the file contains image features, otherwise it contains region features.
file - Path of the temporary text file to be used for creating the index.
fm - Feature Manager for accessing features.
Returns:
true if the text file was successfully created, false otherwise.

createIndexBIN

public boolean createIndexBIN(boolean isImage,
                              java.lang.String file)
Creates a new index using feature stored in a DB.

Parameters:
isImage - If true creates a image index, otherwise creates a region index.
file - Path of the temporary text file to be used for creating the index.
Returns:
true if the index was successfully created, false otherwise.

insertNewImage

public boolean insertNewImage(Document.Image i)
Inserts a new image in the image index.

Parameters:
i - The image to be inserted.
Returns:
true if the image was successfully inserted, false otherwise.

deleteImage

public boolean deleteImage(Document.Image i)
Deletes an image from the image index.

Parameters:
i - The image to be deleted.
Returns:
true if the image was successfully deleted, false otherwise.

insertNewRegion

public boolean insertNewRegion(Document.ImageID id,
                               Document.Region r)
Inserts a new region in the region index.

Parameters:
id - ID of the region to be inserted.
r - The region to be inserted.
Returns:
true if the region was successfully inserted, false otherwise.

deleteRegion

public boolean deleteRegion(Document.ImageID id,
                            Document.Region r)
Deletes a region from the region index.

Parameters:
id - ID of the region to be deleted.
r - The region to be deleted.
Returns:
true if the region was successfully deleted, false otherwise.

createImageCursor

public boolean createImageCursor(Document.Image i)
Creates a cursor over a query image.

Parameters:
i - The query image.
Returns:
true if the cursor was successfully created, false otherwise.

getNextImageCursor

public QueryProcessor.SF.ScoredResultImage getNextImageCursor()
Retrieves the next result from an image cursor.

Returns:
The next image in the cursor.

closeCursorImg

public boolean closeCursorImg()
Closes an image cursor.

Returns:
true if the cursor was successfully closed, false otherwise.

createRegionCursors

public boolean createRegionCursors(Document.Image i)
Creates cursors over regions of a query image.

Parameters:
i - The query image.
Returns:
true if the cursors were successfully created, false otherwise.

getNextCursorsReg

public QueryProcessor.SF.ScoredResultImage getNextCursorsReg(int index)
Retrieves the next result from a given region cursor.

Parameters:
index - The cursor that should perform the sorted access.
Returns:
The next region in the given cursor.

closeCursorsReg

public boolean closeCursorsReg()
Closes the region cursor.

Returns:
true if the cursors were successfully closed, false otherwise.