org.egothor.cache
Class CachedIListPage

java.lang.Object
  extended by org.egothor.cache.CachedIListPage

public class CachedIListPage
extends java.lang.Object

Represent one page of an inverted list stored in a cache.


Constructor Summary
CachedIListPage(int capacity, long id)
          Constructor for the CachedIListPage object.
 
Method Summary
 boolean addCachedIListItem(CachedIListItem item)
          Adds a new item to the page.
 long capacity()
          Returns the capacity of the page.
 long getId()
          Gets the page id.
 CachedIListItem getIListItem(int id)
          Gets an item on the requested position.
 boolean isFull()
          Checks whether the page is full.
 long maxId()
          Returns the ID of last stored item or -1 if the page is empty.
 long size()
          Returns the number of items in the page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedIListPage

public CachedIListPage(int capacity,
                       long id)
Constructor for the CachedIListPage object.

Parameters:
capacity - capacity of the page
id - id of the page
Method Detail

addCachedIListItem

public boolean addCachedIListItem(CachedIListItem item)
Adds a new item to the page.

Parameters:
item - item to add to page.
Returns:
true, if the item was added, false otherwise

getIListItem

public CachedIListItem getIListItem(int id)
Gets an item on the requested position.

Parameters:
id - position of the requested item
Returns:
item located on the requested position

getId

public long getId()
Gets the page id.

Returns:
page id

isFull

public boolean isFull()
Checks whether the page is full.

Returns:
true if the page is full, false otherwise

size

public long size()
Returns the number of items in the page.

Returns:
number of items in the page

capacity

public long capacity()
Returns the capacity of the page.

Returns:
capacity of the page

maxId

public long maxId()
Returns the ID of last stored item or -1 if the page is empty.

Returns:
ID of last stored item or -1 if the page is empty