org.egothor.slotter
Class BarrelShadow

java.lang.Object
  extended by org.egothor.slotter.BarrelShadow
All Implemented Interfaces:
Barrel

public final class BarrelShadow
extends java.lang.Object
implements Barrel

BarrelShadow.java

Author:
galambos

Constructor Summary
BarrelShadow(Barrel orig, boolean closeable, boolean commitable, boolean destroyable, boolean setbitmap)
           
 
Method Summary
 void close()
          Close this Barrel.
 void commit()
          Commit changes of this barrel to disk.
 long deleted()
          Return the number of deleted documents in this Barrel.
 void destroy()
          Destroy all data structures this Barrel uses.
 Sequence<? extends IListMetadata> expand(java.lang.String expr)
          Return the enumeration of all IListMetadata objects which match the expression.
 Bitmap getBitmap(java.lang.String label)
          Return the Bitmap of a given label.
 IListMetadata getIListMeta(java.lang.String term)
          Return the inverted list metadata of the given term.
 DocumentData getMeta(long uid)
          Return the metadata of document number uid.
 BarrelReader open()
          Return a reader for this Barrel.
 IListReader openIList(java.lang.String term, boolean clean)
          Open the inverted list of term for reading.
 void query(Query q, ResultList result)
          Submit a query to this Barrel.
 boolean removeDoc(long id)
          Remove the given document from this Barrel.
 void setBitmap(java.lang.String label, Bitmap bitmap)
          Try to set the Bitmap of a given label.
 long size()
          Return the number of all documents in this Barrel (including the deleted ones).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BarrelShadow

public BarrelShadow(Barrel orig,
                    boolean closeable,
                    boolean commitable,
                    boolean destroyable,
                    boolean setbitmap)
Method Detail

expand

public Sequence<? extends IListMetadata> expand(java.lang.String expr)
Return the enumeration of all IListMetadata objects which match the expression.

Specified by:
expand in interface Barrel
Parameters:
expr - the expression to match
Returns:
null when not supported

getBitmap

public Bitmap getBitmap(java.lang.String label)
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

getIListMeta

public IListMetadata getIListMeta(java.lang.String term)
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)
Open the inverted list of term for reading.

Specified by:
openIList in interface Barrel
Parameters:
term - the term
clean - whether to remove all the items denoted as deleted
Returns:
an IListReader to read the inverted list, or null if the term is not in this Barrel

getMeta

public DocumentData getMeta(long uid)
Return the metadata of document number uid.

Specified by:
getMeta in interface Barrel
Parameters:
uid - the document number
Returns:
a DDocumentDataobject containing the metadata of the given document, or null if the document does not exist in the Barrel

removeDoc

public boolean removeDoc(long id)
Remove the given document from this Barrel.

Specified by:
removeDoc in interface Barrel
Parameters:
id - the document to remove
Returns:
true if the document exists and was not already removed, false otherwise

query

public void query(Query q,
                  ResultList result)
Submit a query to this Barrel.

Above 1.2.5 : the equation of similarity in the extended boolean model. If p=1 the model is similar to the vector space model. As p approaches infinity (or a very large value), the model is equal to the classic boolean model. This parameter is not passed as a parameter to this routine - it should be part of the query object.

Specified by:
query in interface Barrel
Parameters:
q - the query
result - reads documents for similarity to the query

commit

public void commit()
Commit changes of this barrel to disk.

Specified by:
commit in interface Barrel

deleted

public long deleted()
Return the number of deleted documents in this Barrel.

Specified by:
deleted in interface Barrel
Returns:
the number of deleted documents

destroy

public void destroy()
Destroy all data structures this Barrel uses.

Specified by:
destroy in interface Barrel

open

public BarrelReader open()
Return a reader for this Barrel.

Specified by:
open in interface Barrel
Returns:
a BarrelReader

size

public long size()
Return the number of all documents in this Barrel (including the deleted ones).

Specified by:
size in interface Barrel
Returns:
the number of documents

close

public void close()
Close this Barrel.

Specified by:
close in interface Barrel

setBitmap

public void setBitmap(java.lang.String label,
                      Bitmap bitmap)
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
bitmap - Bitmap of removed documents when label is null