de.lmu.ifi.dbs.elki.persistent
Class AbstractStoringPageFile<P extends Page>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.persistent.AbstractPageFile<P>
      extended by de.lmu.ifi.dbs.elki.persistent.AbstractStoringPageFile<P>
Type Parameters:
P - Page type
All Implemented Interfaces:
PageFile<P>, PageFileStatistics
Direct Known Subclasses:
MemoryPageFile, OnDiskArrayPageFile, PersistentPageFile

public abstract class AbstractStoringPageFile<P extends Page>
extends AbstractPageFile<P>

Abstract class implementing general methods of a PageFile. A PageFile stores objects that implement the Page interface.


Field Summary
protected  Stack<Integer> emptyPages
          A stack holding the empty page ids.
protected  int nextPageID
          The last page ID.
protected  int pageSize
          The size of a page in Bytes.
 
Fields inherited from class de.lmu.ifi.dbs.elki.persistent.AbstractPageFile
readAccess, writeAccess
 
Constructor Summary
protected AbstractStoringPageFile(int pageSize)
          Creates a new PageFile.
 
Method Summary
 void deletePage(int pageID)
          Deletes the node with the specified id from this file.
 PageFileStatistics getInnerStatistics()
          Get statistics for the inner page file, if present.
private  Integer getNextEmptyPageID()
          Returns the next empty page id.
 int getNextPageID()
          Returns the next page id.
 int getPageSize()
          Get the page size of this page file.
 boolean initialize(PageHeader header)
          Initialize the page file with the given header - return "true" if the file already existed.
 void setNextPageID(int nextPageID)
          Sets the next page id.
 Integer setPageID(P page)
          Sets the id of the given page.
 
Methods inherited from class de.lmu.ifi.dbs.elki.persistent.AbstractPageFile
close, getReadOperations, getWriteOperations, resetPageAccess, writePage, writePage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.persistent.PageFile
clear, readPage
 

Field Detail

emptyPages

protected Stack<Integer> emptyPages
A stack holding the empty page ids.


nextPageID

protected int nextPageID
The last page ID.


pageSize

protected int pageSize
The size of a page in Bytes.

Constructor Detail

AbstractStoringPageFile

protected AbstractStoringPageFile(int pageSize)
Creates a new PageFile.

Method Detail

setPageID

public Integer setPageID(P page)
Sets the id of the given page.

Parameters:
page - the page to set the id
Returns:
the page id

deletePage

public void deletePage(int pageID)
Deletes the node with the specified id from this file.

Parameters:
pageID - the id of the node to be deleted

getNextEmptyPageID

private Integer getNextEmptyPageID()
Returns the next empty page id.

Returns:
the next empty page id

getNextPageID

public int getNextPageID()
Returns the next page id.

Returns:
the next page id

setNextPageID

public void setNextPageID(int nextPageID)
Sets the next page id.

Parameters:
nextPageID - the next page id to be set

getPageSize

public int getPageSize()
Get the page size of this page file.

Returns:
page size

initialize

public boolean initialize(PageHeader header)
Initialize the page file with the given header - return "true" if the file already existed.

Parameters:
header - Header
Returns:
true when the file already existed.

getInnerStatistics

public PageFileStatistics getInnerStatistics()
Description copied from interface: PageFileStatistics
Get statistics for the inner page file, if present.

Returns:
Inner page file statistics, or null.

Release 0.4.0 (2011-09-20_1324)