net.obsearch.index.bucket.impl
Class AbstractBucketContainerDouble<O extends OBDouble,B extends BucketObjectDouble>

java.lang.Object
  extended by net.obsearch.index.bucket.impl.AbstractBucketContainerDouble<O,B>
All Implemented Interfaces:
net.obsearch.index.bucket.BucketContainer<O,B,OBQueryDouble<O>>
Direct Known Subclasses:
BucketContainerDouble

public abstract class AbstractBucketContainerDouble<O extends OBDouble,B extends BucketObjectDouble>
extends Object
implements net.obsearch.index.bucket.BucketContainer<O,B,OBQueryDouble<O>>

AbstractBucketContainerDouble Holds the functionality of a bucket that sorts its smap-vectors lexicographically. Binary searches are employed inside the vector.

Author:
Arnoldo Jose Muller Molina

Field Summary
protected  byte[] key
          Iterate only through this key.
 
Constructor Summary
AbstractBucketContainerDouble(net.obsearch.Index<O> index, int pivots, net.obsearch.storage.OBStore<net.obsearch.storage.TupleBytes> storage, byte[] key)
          Build a new container for doubles over the given index, with the given pivot number and a certain storage device where all the smap vectors are stored.
AbstractBucketContainerDouble(net.obsearch.Index<O> index, int pivots, net.obsearch.storage.OBStore<net.obsearch.storage.TupleBytes> storage, byte[] key, int secondaryIndexPivot)
          Build a new container for doubles over the given index, with the given pivot number and a certain storage device where all the smap vectors are stored.
 
Method Summary
 net.obsearch.OperationStatus delete(B bucket, O object)
           
 net.obsearch.OperationStatus exists(B bucket, O object)
           
 List<B> getObjects()
          Return the object list!
 int getPivots()
           
 net.obsearch.OperationStatus insert(B bucket, O object)
          Insert the given bucket into the container.
 net.obsearch.OperationStatus insertBulk(B bucket, O object)
          Insert the given bucket into the container.
protected abstract  B instantiateBucketObject()
          Instantiate a new Bucket ready to process each record.
 boolean isModified()
           
 void search(net.obsearch.query.AbstractOBQuery<O> q, B bucket, net.obsearch.filter.Filter<O> filter, net.obsearch.stats.Statistics stats)
           
 void search(OBQueryDouble<O> query, B b, ByteBuffer data, net.obsearch.filter.Filter<O> filter, net.obsearch.stats.Statistics stats)
           
 void search(OBQueryDouble<O> query, B b, net.obsearch.filter.Filter<O> filter, byte[] key1, byte[] key2, net.obsearch.stats.Statistics stats)
          Convenience method that forces the search to be performed on a certain key set.
 void search(OBQueryDouble<O> query, B b, net.obsearch.filter.Filter<O> filter, net.obsearch.stats.Statistics stats)
          Searches the data by using a binary search to reduce SMAP vector computations.
 byte[] serialize()
           
 void setKey(byte[] key)
           
 void setPivots(int pivots)
           
 int size()
          Return the # of S-Map vectors in the bucket.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

protected byte[] key
Iterate only through this key.

Constructor Detail

AbstractBucketContainerDouble

public AbstractBucketContainerDouble(net.obsearch.Index<O> index,
                                     int pivots,
                                     net.obsearch.storage.OBStore<net.obsearch.storage.TupleBytes> storage,
                                     byte[] key)
Build a new container for doubles over the given index, with the given pivot number and a certain storage device where all the smap vectors are stored. Key is used as the base key for this bucket.

Parameters:
index - Underlying index.
pivots - Number of pivots employed
storage - Storage device where the smap vectors are stored.
key - Base key of this container

AbstractBucketContainerDouble

public AbstractBucketContainerDouble(net.obsearch.Index<O> index,
                                     int pivots,
                                     net.obsearch.storage.OBStore<net.obsearch.storage.TupleBytes> storage,
                                     byte[] key,
                                     int secondaryIndexPivot)
Build a new container for doubles over the given index, with the given pivot number and a certain storage device where all the smap vectors are stored. Key is used as the base key for this bucket. The parameter secondaryIndexPivot chooses a dimension of the s-map vector to sort the vectors by this value. This helps in prunning a bit the buckets.

Parameters:
index - Underlying index.
pivots - Number of pivots employed
storage - Storage device where the smap vectors are stored.
key - Base key of this container
secondaryIndexPivot - Sort records by this dimension.
Method Detail

getObjects

public List<B> getObjects()
Return the object list!

Specified by:
getObjects in interface net.obsearch.index.bucket.BucketContainer<O extends OBDouble,B extends BucketObjectDouble,OBQueryDouble<O extends OBDouble>>
Returns:

instantiateBucketObject

protected abstract B instantiateBucketObject()
Instantiate a new Bucket ready to process each record.


setPivots

public void setPivots(int pivots)
Specified by:
setPivots in interface net.obsearch.index.bucket.BucketContainer<O extends OBDouble,B extends BucketObjectDouble,OBQueryDouble<O extends OBDouble>>

delete

public net.obsearch.OperationStatus delete(B bucket,
                                           O object)
                                    throws net.obsearch.exception.OBException,
                                           net.obsearch.exception.IllegalIdException,
                                           IllegalAccessException,
                                           InstantiationException
Specified by:
delete in interface net.obsearch.index.bucket.BucketContainer<O extends OBDouble,B extends BucketObjectDouble,OBQueryDouble<O extends OBDouble>>
Throws:
net.obsearch.exception.OBException
net.obsearch.exception.IllegalIdException
IllegalAccessException
InstantiationException

insert

public net.obsearch.OperationStatus insert(B bucket,
                                           O object)
                                    throws net.obsearch.exception.OBException,
                                           net.obsearch.exception.IllegalIdException,
                                           IllegalAccessException,
                                           InstantiationException
Insert the given bucket into the container.

Specified by:
insert in interface net.obsearch.index.bucket.BucketContainer<O extends OBDouble,B extends BucketObjectDouble,OBQueryDouble<O extends OBDouble>>
Parameters:
bucket - Bucket to insert.
object - the bucket has an object.
Returns:
The result of the operation.
Throws:
net.obsearch.exception.OBException
net.obsearch.exception.IllegalIdException
IllegalAccessException
InstantiationException

insertBulk

public net.obsearch.OperationStatus insertBulk(B bucket,
                                               O object)
                                        throws net.obsearch.exception.OBException,
                                               net.obsearch.exception.IllegalIdException,
                                               IllegalAccessException,
                                               InstantiationException
Insert the given bucket into the container.

Specified by:
insertBulk in interface net.obsearch.index.bucket.BucketContainer<O extends OBDouble,B extends BucketObjectDouble,OBQueryDouble<O extends OBDouble>>
Parameters:
bucket - Bucket to insert.
object - the bucket has an object.
Returns:
The result of the operation.
Throws:
net.obsearch.exception.OBException
net.obsearch.exception.IllegalIdException
IllegalAccessException
InstantiationException

exists

public net.obsearch.OperationStatus exists(B bucket,
                                           O object)
                                    throws net.obsearch.exception.OBException,
                                           net.obsearch.exception.IllegalIdException,
                                           IllegalAccessException,
                                           InstantiationException
Specified by:
exists in interface net.obsearch.index.bucket.BucketContainer<O extends OBDouble,B extends BucketObjectDouble,OBQueryDouble<O extends OBDouble>>
Throws:
net.obsearch.exception.OBException
net.obsearch.exception.IllegalIdException
IllegalAccessException
InstantiationException

search

public void search(OBQueryDouble<O> query,
                   B b,
                   ByteBuffer data,
                   net.obsearch.filter.Filter<O> filter,
                   net.obsearch.stats.Statistics stats)
            throws IllegalAccessException,
                   net.obsearch.exception.OBException,
                   InstantiationException,
                   net.obsearch.exception.IllegalIdException
Specified by:
search in interface net.obsearch.index.bucket.BucketContainer<O extends OBDouble,B extends BucketObjectDouble,OBQueryDouble<O extends OBDouble>>
Throws:
IllegalAccessException
net.obsearch.exception.OBException
InstantiationException
net.obsearch.exception.IllegalIdException

search

public void search(net.obsearch.query.AbstractOBQuery<O> q,
                   B bucket,
                   net.obsearch.filter.Filter<O> filter,
                   net.obsearch.stats.Statistics stats)
            throws IllegalAccessException,
                   net.obsearch.exception.OBException,
                   InstantiationException,
                   net.obsearch.exception.IllegalIdException
Specified by:
search in interface net.obsearch.index.bucket.BucketContainer<O extends OBDouble,B extends BucketObjectDouble,OBQueryDouble<O extends OBDouble>>
Throws:
IllegalAccessException
net.obsearch.exception.OBException
InstantiationException
net.obsearch.exception.IllegalIdException

search

public void search(OBQueryDouble<O> query,
                   B b,
                   net.obsearch.filter.Filter<O> filter,
                   net.obsearch.stats.Statistics stats)
            throws IllegalAccessException,
                   net.obsearch.exception.OBException,
                   InstantiationException,
                   net.obsearch.exception.IllegalIdException
Searches the data by using a binary search to reduce SMAP vector computations. Does not cache objects and creates less objects during the search than searchSorted(...).

Specified by:
search in interface net.obsearch.index.bucket.BucketContainer<O extends OBDouble,B extends BucketObjectDouble,OBQueryDouble<O extends OBDouble>>
Parameters:
query -
b -
Throws:
IllegalAccessException
DatabaseException
net.obsearch.exception.OBException
InstantiationException
net.obsearch.exception.IllegalIdException

search

public void search(OBQueryDouble<O> query,
                   B b,
                   net.obsearch.filter.Filter<O> filter,
                   byte[] key1,
                   byte[] key2,
                   net.obsearch.stats.Statistics stats)
            throws IllegalAccessException,
                   net.obsearch.exception.OBException,
                   InstantiationException,
                   net.obsearch.exception.IllegalIdException
Convenience method that forces the search to be performed on a certain key set.

Throws:
IllegalAccessException
net.obsearch.exception.OBException
InstantiationException
net.obsearch.exception.IllegalIdException

getPivots

public int getPivots()
Specified by:
getPivots in interface net.obsearch.index.bucket.BucketContainer<O extends OBDouble,B extends BucketObjectDouble,OBQueryDouble<O extends OBDouble>>

size

public int size()
         throws net.obsearch.exception.OBException
Return the # of S-Map vectors in the bucket.

Specified by:
size in interface net.obsearch.index.bucket.BucketContainer<O extends OBDouble,B extends BucketObjectDouble,OBQueryDouble<O extends OBDouble>>
Throws:
net.obsearch.exception.OBException

setKey

public void setKey(byte[] key)
Specified by:
setKey in interface net.obsearch.index.bucket.BucketContainer<O extends OBDouble,B extends BucketObjectDouble,OBQueryDouble<O extends OBDouble>>

serialize

public byte[] serialize()
Specified by:
serialize in interface net.obsearch.index.bucket.BucketContainer<O extends OBDouble,B extends BucketObjectDouble,OBQueryDouble<O extends OBDouble>>

isModified

public boolean isModified()
Specified by:
isModified in interface net.obsearch.index.bucket.BucketContainer<O extends OBDouble,B extends BucketObjectDouble,OBQueryDouble<O extends OBDouble>>


Copyright © 2007-2011 Arnoldo Jose Muller Molina. All Rights Reserved.