Package elki.persistent
Class AbstractStoringPageFile<P extends Page>
- java.lang.Object
-
- elki.persistent.AbstractPageFile<P>
-
- elki.persistent.AbstractStoringPageFile<P>
-
- Type Parameters:
P- Page type
- All Implemented Interfaces:
PageFile<P>
- 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 thePageinterface.- Since:
- 0.1
- Author:
- Elke Achtert
-
-
Field Summary
Fields Modifier and Type Field Description protected IntegerArrayemptyPagesA stack holding the empty page ids.protected intnextPageIDThe last page ID.protected intpageSizeThe size of a page in Bytes.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractStoringPageFile(int pageSize)Creates a new PageFile.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeletePage(int pageID)Deletes the node with the specified id from this file.private intgetNextEmptyPageID()Returns the next empty page id.intgetNextPageID()Returns the next page id.intgetPageSize()Get the page size of this page file.booleaninitialize(PageHeader header)Initialize the page file with the given header - return "true" if the file already existed.voidlogStatistics()Log some statistics to the appropriate logger.voidsetNextPageID(int nextPageID)Sets the next page id.intsetPageID(P page)Sets the id of the given page.-
Methods inherited from class elki.persistent.AbstractPageFile
close, countRead, countWrite, getLogger, writePage, writePage
-
-
-
-
Field Detail
-
emptyPages
protected IntegerArray 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.
-
-
Method Detail
-
setPageID
public int 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 int 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.
-
logStatistics
public void logStatistics()
Description copied from interface:PageFileLog some statistics to the appropriate logger.- Specified by:
logStatisticsin interfacePageFile<P extends Page>- Overrides:
logStatisticsin classAbstractPageFile<P extends Page>
-
-