net.obsearch.index.bucket.sleek
Class SleekBucketFloat<O extends OBFloat>

java.lang.Object
  extended by net.obsearch.index.bucket.sleek.SleekBucketFloat<O>
All Implemented Interfaces:
BucketContainer<O,BucketObjectFloat<O>,OBQueryFloat<O>>

public class SleekBucketFloat<O extends OBFloat>
extends Object
implements BucketContainer<O,BucketObjectFloat<O>,OBQueryFloat<O>>

AbstractSleekBucket is designed to hold objects that belong to one bucket. The bucket will hold ALL the buckets. Optionally, objects inside the bucket can be used as pivotCount. Format: ... ... .... This bucket design focuses on pivotCount local to a partition instead of global pivotCount. Also, the storage and reading of the container is responsability of the index. The class does not access directly the index unlike the bucket.* classes we now have something that partitions the data properly.

Author:
Arnoldo Jose Muller Molina

Constructor Summary
SleekBucketFloat(Class<O> type, int pivots)
          Create an empty, new bucket.
SleekBucketFloat(Class<O> type, int pivots, byte[] data)
          Create a new SleekBucket based on the given data.
 
Method Summary
 OperationStatus delete(BucketObjectFloat<O> bucket, O object)
          Deletes the given object from this BucketContainer.
 boolean equals(Object o)
           
 OperationStatus exists(BucketObjectFloat<O> bucket, O object)
          Returns true if the object and its bucket definition exist in this container
 List<BucketObjectFloat<O>> getObjects()
          Return the object list!
 int getPivots()
          # of pivots for this container.
 OperationStatus insert(BucketObjectFloat<O> bucket, O object)
          Inserts the given object with the given bucket details to this bucket.
 OperationStatus insertBulk(BucketObjectFloat<O> bucket, O object)
          Inserts the given object with the given bucket details to this bucket.
 boolean isModified()
          Return true if the bucket has been modified since it was instantiated.
 void parseData(int pivotCount, byte[] data)
          Parses the data from the given byte array.
 void search(AbstractOBQuery<O> q, BucketObjectFloat<O> bucket, Filter<O> filter, Statistics stats)
          Same as BucketContainer.search(AbstractOBQuery, BucketObject, Filter, Statistics) but it forces the query AbstractOBQuery into the correct type.
 void search(OBQueryFloat<O> query, BucketObjectFloat<O> bucket, ByteBuffer b, Filter<O> filter, Statistics stats)
          Match the given query and bucket but only for one record found in b.
 void search(OBQueryFloat<O> query, BucketObjectFloat<O> bucket, Filter<O> filter, Statistics stats)
          Searches the given object with the given searchContainer parameters.
 byte[] serialize()
          Serialize the bucket into a stream of bytes.
 void setKey(byte[] key)
          Sets the key (bucket id) of a bucket container
 void setPivots(int pivots)
          Sets the # of pivots for this container.
 int size()
          # of objects in this container.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SleekBucketFloat

public SleekBucketFloat(Class<O> type,
                        int pivots)
Create an empty, new bucket.

Parameters:
pivotCount - number of pivotCount to use.

SleekBucketFloat

public SleekBucketFloat(Class<O> type,
                        int pivots,
                        byte[] data)
                 throws InstantiationException,
                        IllegalAccessException,
                        OBException,
                        IOException
Create a new SleekBucket based on the given data.

Parameters:
pivotCount -
data -
Throws:
IOException
OBException
IllegalAccessException
InstantiationException
IOException
Method Detail

getObjects

public List<BucketObjectFloat<O>> getObjects()
Description copied from interface: BucketContainer
Return the object list!

Specified by:
getObjects in interface BucketContainer<O extends OBFloat,BucketObjectFloat<O extends OBFloat>,OBQueryFloat<O extends OBFloat>>
Returns:

parseData

public void parseData(int pivotCount,
                      byte[] data)
               throws InstantiationException,
                      IllegalAccessException,
                      OBException,
                      IOException
Parses the data from the given byte array.

Parameters:
data -
Throws:
IllegalAccessException
InstantiationException
IOException
OBException

equals

public boolean equals(Object o)
Overrides:
equals in class Object

delete

public OperationStatus delete(BucketObjectFloat<O> bucket,
                              O object)
                       throws OBException,
                              IllegalIdException,
                              IllegalAccessException,
                              InstantiationException
Description copied from interface: BucketContainer
Deletes the given object from this BucketContainer.

Specified by:
delete in interface BucketContainer<O extends OBFloat,BucketObjectFloat<O extends OBFloat>,OBQueryFloat<O extends OBFloat>>
Parameters:
bucket - This will should match this bucket's id. Used to pass additional information such as the SMAP vector
object - The object that will be deleted.
Returns:
Status.OK and the deleted object's id if the object was found and successfully deleted. Status.NOT_EXISTS if the object is not in the database.
Throws:
OBException
IllegalIdException
IllegalAccessException
InstantiationException

isModified

public boolean isModified()
Description copied from interface: BucketContainer
Return true if the bucket has been modified since it was instantiated.

Specified by:
isModified in interface BucketContainer<O extends OBFloat,BucketObjectFloat<O extends OBFloat>,OBQueryFloat<O extends OBFloat>>
Returns:
true if the bucket has been modified since it was instantiated.

exists

public OperationStatus exists(BucketObjectFloat<O> bucket,
                              O object)
                       throws OBException,
                              IllegalIdException,
                              IllegalAccessException,
                              InstantiationException
Description copied from interface: BucketContainer
Returns true if the object and its bucket definition exist in this container

Specified by:
exists in interface BucketContainer<O extends OBFloat,BucketObjectFloat<O extends OBFloat>,OBQueryFloat<O extends OBFloat>>
Parameters:
bucket - The bucket associated to object
object - The object that will be inserted
Returns:
true if object exists in this container.
Throws:
OBException
IllegalIdException
IllegalAccessException
InstantiationException

getPivots

public int getPivots()
Description copied from interface: BucketContainer
# of pivots for this container.

Specified by:
getPivots in interface BucketContainer<O extends OBFloat,BucketObjectFloat<O extends OBFloat>,OBQueryFloat<O extends OBFloat>>
Returns:

insert

public OperationStatus insert(BucketObjectFloat<O> bucket,
                              O object)
                       throws OBException,
                              IllegalIdException,
                              IllegalAccessException,
                              InstantiationException
Description copied from interface: BucketContainer
Inserts the given object with the given bucket details to this bucket. Warning: This method assumes that object does not exist in the DB. In bucket, an id will be provided by the caller.

Specified by:
insert in interface BucketContainer<O extends OBFloat,BucketObjectFloat<O extends OBFloat>,OBQueryFloat<O extends OBFloat>>
Parameters:
bucket - This will should match this bucket's id. Used to pass additional information such as the SMAP vector.
Returns:
If Status.OK or Status.EXISTS then the result will hold the id of the inserted object and the operation is successful.
Throws:
OBException
IllegalIdException
IllegalAccessException
InstantiationException

insertBulk

public OperationStatus insertBulk(BucketObjectFloat<O> bucket,
                                  O object)
                           throws OBException,
                                  IllegalIdException,
                                  IllegalAccessException,
                                  InstantiationException
Description copied from interface: BucketContainer
Inserts the given object with the given bucket details to this bucket. No existence checks are performed, we believe the caller each object is unique or the caller does not care about uniqueness.

Specified by:
insertBulk in interface BucketContainer<O extends OBFloat,BucketObjectFloat<O extends OBFloat>,OBQueryFloat<O extends OBFloat>>
Parameters:
bucket - This will should match this bucket's id. Used to pass additional information such as the SMAP vector.
Returns:
Status.OK
Throws:
OBException
IllegalIdException
IllegalAccessException
InstantiationException

search

public void search(AbstractOBQuery<O> q,
                   BucketObjectFloat<O> bucket,
                   Filter<O> filter,
                   Statistics stats)
            throws IllegalAccessException,
                   OBException,
                   InstantiationException,
                   IllegalIdException
Description copied from interface: BucketContainer
Same as BucketContainer.search(AbstractOBQuery, BucketObject, Filter, Statistics) but it forces the query AbstractOBQuery into the correct type.

Specified by:
search in interface BucketContainer<O extends OBFloat,BucketObjectFloat<O extends OBFloat>,OBQueryFloat<O extends OBFloat>>
Throws:
IllegalAccessException
OBException
IllegalIdException
InstantiationException

search

public void search(OBQueryFloat<O> query,
                   BucketObjectFloat<O> bucket,
                   ByteBuffer b,
                   Filter<O> filter,
                   Statistics stats)
            throws IllegalAccessException,
                   OBException,
                   InstantiationException,
                   IllegalIdException
Description copied from interface: BucketContainer
Match the given query and bucket but only for one record found in b.

Specified by:
search in interface BucketContainer<O extends OBFloat,BucketObjectFloat<O extends OBFloat>,OBQueryFloat<O extends OBFloat>>
Parameters:
query - The search parameters (range, priority queue with the closest elements)
bucket - The bucket of the given object.
filter - Filter to be employed.
Throws:
IllegalAccessException
OBException
InstantiationException
IllegalIdException

search

public void search(OBQueryFloat<O> query,
                   BucketObjectFloat<O> bucket,
                   Filter<O> filter,
                   Statistics stats)
            throws IllegalAccessException,
                   OBException,
                   InstantiationException,
                   IllegalIdException
Description copied from interface: BucketContainer
Searches the given object with the given searchContainer parameters. The searchContainer will be updated as necessary.

Specified by:
search in interface BucketContainer<O extends OBFloat,BucketObjectFloat<O extends OBFloat>,OBQueryFloat<O extends OBFloat>>
Parameters:
query - The search parameters (range, priority queue with the closest elements)
bucket - The bucket of the given object.
filter - Filter to be employed.
Throws:
IllegalAccessException
OBException
InstantiationException
IllegalIdException

serialize

public byte[] serialize()
                 throws OBException
Serialize the bucket into a stream of bytes.

Specified by:
serialize in interface BucketContainer<O extends OBFloat,BucketObjectFloat<O extends OBFloat>,OBQueryFloat<O extends OBFloat>>
Returns:
The list of
Throws:
IOException
OBException

setKey

public void setKey(byte[] key)
Description copied from interface: BucketContainer
Sets the key (bucket id) of a bucket container

Specified by:
setKey in interface BucketContainer<O extends OBFloat,BucketObjectFloat<O extends OBFloat>,OBQueryFloat<O extends OBFloat>>

setPivots

public void setPivots(int pivots)
Description copied from interface: BucketContainer
Sets the # of pivots for this container.

Specified by:
setPivots in interface BucketContainer<O extends OBFloat,BucketObjectFloat<O extends OBFloat>,OBQueryFloat<O extends OBFloat>>

size

public int size()
Description copied from interface: BucketContainer
# of objects in this container.

Specified by:
size in interface BucketContainer<O extends OBFloat,BucketObjectFloat<O extends OBFloat>,OBQueryFloat<O extends OBFloat>>
Returns:
The # of objects in this container.

toString

public String toString()
Overrides:
toString in class Object


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