org.egothor.store
Class ThickBarrel

java.lang.Object
  extended by org.egothor.store.ThickBarrel
All Implemented Interfaces:
java.lang.Cloneable, Barrel

public class ThickBarrel
extends java.lang.Object
implements Barrel, java.lang.Cloneable

This object is a core implementation of a barrel that has documents meta data stored in DiscIndexData and inverted lists meta data in DiscKeyIndexData. This object defines a barrel that stores its inverted lists in one big file.

Author:
Leo Galambos

Field Summary
 java.lang.String location
          Directory, where is the barrel stored.
 
Constructor Summary
ThickBarrel(java.lang.String location)
          This constructors open the documents and inverted lists meta data DB files in location directory.
 
Method Summary
 java.lang.Object clone()
           
 void close()
          Closes DB files.
 void commit()
          Not implemented but required by Barrel.
 long deleted()
          Returns the number of removed documents (meta data).
 void destroy()
          This method calls close and then removes all files that this barrel uses.
static void destroy(java.lang.String location)
           
 Sequence<? extends IListMetadata> expand(java.lang.String expr)
          Description of the Method
 Bitmap getBitmap(java.lang.String label)
          Return the Bitmap of a given label.
 IListMetadataRead getIListMeta(java.lang.String term)
          Return the inverted list metadata of the given term.
 DocumentData getMeta(long uid)
          Returns meta data of a given uid document.
 long length()
          Returns size()-deleted() - the number of active documents.
 BarrelReader open()
          Return a reader for this Barrel.
 IMetaReader openDocMeta()
          Description of the Method
 IListReader openIList(java.lang.String term, boolean clean)
          Description of the Method
 void query(Query q, ResultList result)
          Solves a query in this barrel.
 boolean removeDoc(long id)
          Removes the meta data of the id-th document.
 void setBitmap(java.lang.String label, Bitmap value)
          Try to set the Bitmap of a given label.
 void setLocation(java.lang.String location)
          Sets the location attribute of the ThickBarrel object
 long size()
          Returns the total number of documents meta data.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

location

public java.lang.String location
Directory, where is the barrel stored.

Constructor Detail

ThickBarrel

public ThickBarrel(java.lang.String location)
            throws java.io.IOException
This constructors open the documents and inverted lists meta data DB files in location directory. Constructs this barrel in the given location directory.

Parameters:
location - Description of the Parameter
Throws:
java.io.IOException - if an I/O error occurs
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

getBitmap

public Bitmap getBitmap(java.lang.String label)
Description copied from interface: Barrel
Return the Bitmap of a given label.

Specified by:
getBitmap in interface Barrel
Parameters:
label - the label of the requested Bitmap
Returns:
Bitmap of removed documents when label is null

setBitmap

public void setBitmap(java.lang.String label,
                      Bitmap value)
Description copied from interface: Barrel
Try to set the Bitmap of a given label.

Specified by:
setBitmap in interface Barrel
Parameters:
label - the label of the requested Bitmap
value - Bitmap of removed documents when label is null

setLocation

public void setLocation(java.lang.String location)
                 throws java.io.IOException
Sets the location attribute of the ThickBarrel object

Parameters:
location - The new location value
Throws:
java.io.IOException - if an I/O error occurs

getMeta

public DocumentData getMeta(long uid)
Returns meta data of a given uid document.

Specified by:
getMeta in interface Barrel
Parameters:
uid - Description of the Parameter
Returns:
The meta value

openDocMeta

public IMetaReader openDocMeta()
Description of the Method

Returns:
Description of the Return Value

getIListMeta

public IListMetadataRead getIListMeta(java.lang.String term)
Description copied from interface: Barrel
Return the inverted list metadata of the given term.

Specified by:
getIListMeta in interface Barrel
Parameters:
term - the term
Returns:
an IListMetaData object containing the metadata of the inverted list, or null if the term is not in the Barrel

openIList

public IListReader openIList(java.lang.String term,
                             boolean clean)
Description of the Method

Specified by:
openIList in interface Barrel
Parameters:
term - Description of the Parameter
clean - whether to remove all the items denoted as deleted
Returns:
Description of the Return Value

expand

public Sequence<? extends IListMetadata> expand(java.lang.String expr)
Description of the Method

Specified by:
expand in interface Barrel
Parameters:
expr - Description of the Parameter
Returns:
Description of the Return Value

destroy

public void destroy()
This method calls close and then removes all files that this barrel uses. Destroys the meta data DB files.

Specified by:
destroy in interface Barrel

destroy

public static void destroy(java.lang.String location)

removeDoc

public boolean removeDoc(long id)
Removes the meta data of the id-th document.

Specified by:
removeDoc in interface Barrel
Parameters:
id - Description of the Parameter
Returns:
Description of the Return Value

size

public long size()
Returns the total number of documents meta data. It does not matter if they are removed or not.

Specified by:
size in interface Barrel
Returns:
Description of the Return Value

deleted

public long deleted()
Returns the number of removed documents (meta data).

Specified by:
deleted in interface Barrel
Returns:
Description of the Return Value

open

public BarrelReader open()
Description copied from interface: Barrel
Return a reader for this Barrel.

Specified by:
open in interface Barrel
Returns:
this

length

public long length()
Returns size()-deleted() - the number of active documents.

Returns:
Description of the Return Value

commit

public void commit()
Not implemented but required by Barrel.

Specified by:
commit in interface Barrel

close

public void close()
Closes DB files.

Specified by:
close in interface Barrel

query

public void query(Query q,
                  ResultList result)
Solves a query in this barrel. The query is parsed by Parser. This method also prepares a hit list object that is passed to a rider object. The rider object is allocated with maximum of ten active open inverted lists to this barrel.

Specified by:
query in interface Barrel
Parameters:
q - Description of the Parameter
result - Description of the Parameter