org.egothor.core.memory
Class MemoryIList

java.lang.Object
  extended by org.egothor.core.memory.MemoryIList
All Implemented Interfaces:
IListItem, IListReader, IListWriter, Proximities

public class MemoryIList
extends java.lang.Object
implements IListReader, IListWriter, Proximities

The MemoryIList class is an inverted list stored to memory.

Author:
Leo Galambos

Method Summary
 void append(long new_uid, IListItem item)
          Append a new inverted list item.
 void close()
          Close the reader.
 void closeProx()
          Close this list and release resources.
 long getPostings()
          Return the number of items in the inverted list this object reads (including removed ones).
 java.lang.String getTerm()
          Return the term that owns this inverted list.
 int leftProx()
          Return the number of items in the proximity list which were not read yet.
 boolean next()
          Move to the next item in the inverted list.
 Proximities openProx()
          Return an access object to the proximity list.
 int readProx()
          Read this object's inverted list.
 int readProx(int[] prox, int offset, int len)
          Read an inverted list of length greater than 1.
 boolean skipTo(long uid)
          Skips (forward) in the inverted list to the first item with an ID greater than or equal to the given uid identification.
 long uid()
          Identification of the document.
 int weight()
          Calculated vector value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

append

public void append(long new_uid,
                   IListItem item)
            throws java.io.IOException
Description copied from interface: IListWriter
Append a new inverted list item. It must be stored with the new identification in this list.

Specified by:
append in interface IListWriter
Parameters:
new_uid - The new item identification.
item - The inverted list item.
Throws:
java.io.IOException

close

public void close()
Description copied from interface: IListReader
Close the reader.

Specified by:
close in interface IListReader
Specified by:
close in interface IListWriter

getPostings

public long getPostings()
Description copied from interface: IListReader
Return the number of items in the inverted list this object reads (including removed ones).

Specified by:
getPostings in interface IListReader
Returns:
the number of items

getTerm

public java.lang.String getTerm()
Description copied from interface: IListReader
Return the term that owns this inverted list.

Specified by:
getTerm in interface IListReader
Returns:
the term

next

public boolean next()
Description copied from interface: IListReader
Move to the next item in the inverted list.

Specified by:
next in interface IListReader
Returns:
true if the next item exists

skipTo

public boolean skipTo(long uid)
Description copied from interface: IListReader
Skips (forward) in the inverted list to the first item with an ID greater than or equal to the given uid identification.

Specified by:
skipTo in interface IListReader
Parameters:
uid - the item to skip to
Returns:
true if the next item exists

uid

public long uid()
Description copied from interface: IListItem
Identification of the document. If this value is lower than 0, then this item ought to be supposed to be invalid.

Specified by:
uid in interface IListItem

weight

public int weight()
Description copied from interface: IListItem
Calculated vector value.

Specified by:
weight in interface IListItem

openProx

public Proximities openProx()
Description copied from interface: IListItem
Return an access object to the proximity list.

Specified by:
openProx in interface IListItem
Returns:
a Proximities object

closeProx

public void closeProx()
Description copied from interface: Proximities
Close this list and release resources.

Specified by:
closeProx in interface Proximities

leftProx

public int leftProx()
Description copied from interface: Proximities
Return the number of items in the proximity list which were not read yet.

Specified by:
leftProx in interface Proximities
Returns:
the number of items

readProx

public int readProx()
             throws java.io.IOException
Description copied from interface: Proximities
Read this object's inverted list.

Specified by:
readProx in interface Proximities
Returns:
the position of the item read
Throws:
java.io.IOException

readProx

public int readProx(int[] prox,
                    int offset,
                    int len)
             throws java.io.IOException
Description copied from interface: Proximities
Read an inverted list of length greater than 1. The list will be read in blocks of the specified size.

Specified by:
readProx in interface Proximities
Parameters:
prox - the buffer
offset - first cell to fill
len - how many cell are read
Returns:
how many cells were read
Throws:
java.io.IOException