net.obsearch.index.bucket.sleek
Class SleekBucketDouble<O extends OBDouble >
java.lang.Object
net.obsearch.index.bucket.sleek.SleekBucketDouble<O>
All Implemented Interfaces: BucketContainer <O,BucketObjectDouble <O>,OBQueryDouble <O>>
public class SleekBucketDouble<O extends OBDouble > extends Object implements BucketContainer <O,BucketObjectDouble <O>,OBQueryDouble <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
Method Summary
OperationStatus
delete (BucketObjectDouble <O > bucket,
O object)
Deletes the given object from this BucketContainer
.
boolean
equals (Object o)
OperationStatus
exists (BucketObjectDouble <O > bucket,
O object)
Returns true if the object and its bucket definition exist in this
container
List <BucketObjectDouble <O >>
getObjects ()
Return the object list!
int
getPivots ()
# of pivots for this container.
OperationStatus
insert (BucketObjectDouble <O > bucket,
O object)
Inserts the given object with the given bucket details to this bucket.
OperationStatus
insertBulk (BucketObjectDouble <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,
BucketObjectDouble <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 (OBQueryDouble <O > query,
BucketObjectDouble <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 (OBQueryDouble <O > query,
BucketObjectDouble <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 ()
SleekBucketDouble
public SleekBucketDouble (Class <O > type,
int pivots)
Create an empty, new bucket.
Parameters: pivotCount
- number of pivotCount to use.
SleekBucketDouble
public SleekBucketDouble (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
getObjects
public List <BucketObjectDouble <O >> getObjects ()
Description copied from interface: BucketContainer
Return the object list!
Specified by: getObjects
in interface BucketContainer <O extends OBDouble ,BucketObjectDouble <O extends OBDouble >,OBQueryDouble <O extends OBDouble >>
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 (BucketObjectDouble <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 OBDouble ,BucketObjectDouble <O extends OBDouble >,OBQueryDouble <O extends OBDouble >>
Parameters: bucket
- This will should match this bucket's id. Used to pass
additional information such as the SMAP vectorobject
- 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 OBDouble ,BucketObjectDouble <O extends OBDouble >,OBQueryDouble <O extends OBDouble >>
Returns: true if the bucket has been modified since it was instantiated.
exists
public OperationStatus exists (BucketObjectDouble <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 OBDouble ,BucketObjectDouble <O extends OBDouble >,OBQueryDouble <O extends OBDouble >>
Parameters: bucket
- The bucket associated to objectobject
- 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 OBDouble ,BucketObjectDouble <O extends OBDouble >,OBQueryDouble <O extends OBDouble >>
Returns:
insert
public OperationStatus insert (BucketObjectDouble <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 OBDouble ,BucketObjectDouble <O extends OBDouble >,OBQueryDouble <O extends OBDouble >>
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 (BucketObjectDouble <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 OBDouble ,BucketObjectDouble <O extends OBDouble >,OBQueryDouble <O extends OBDouble >>
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,
BucketObjectDouble <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 OBDouble ,BucketObjectDouble <O extends OBDouble >,OBQueryDouble <O extends OBDouble >>
Throws:
IllegalAccessException
OBException
IllegalIdException
InstantiationException
search
public void search (OBQueryDouble <O > query,
BucketObjectDouble <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 OBDouble ,BucketObjectDouble <O extends OBDouble >,OBQueryDouble <O extends OBDouble >>
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 (OBQueryDouble <O > query,
BucketObjectDouble <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 OBDouble ,BucketObjectDouble <O extends OBDouble >,OBQueryDouble <O extends OBDouble >>
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 OBDouble ,BucketObjectDouble <O extends OBDouble >,OBQueryDouble <O extends OBDouble >>
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 OBDouble ,BucketObjectDouble <O extends OBDouble >,OBQueryDouble <O extends OBDouble >>
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 OBDouble ,BucketObjectDouble <O extends OBDouble >,OBQueryDouble <O extends OBDouble >>
size
public int size ()
Description copied from interface: BucketContainer
# of objects in this container.
Specified by: size
in interface BucketContainer <O extends OBDouble ,BucketObjectDouble <O extends OBDouble >,OBQueryDouble <O extends OBDouble >>
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.