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 thePage
interface.- Since:
- 0.1
- Author:
- Elke Achtert
-
-
Field Summary
Fields Modifier and Type Field Description protected IntegerArray
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.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractStoringPageFile(int pageSize)
Creates a new PageFile.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deletePage(int pageID)
Deletes the node with the specified id from this file.private int
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
logStatistics()
Log some statistics to the appropriate logger.void
setNextPageID(int nextPageID)
Sets the next page id.int
setPageID(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:PageFile
Log some statistics to the appropriate logger.- Specified by:
logStatistics
in interfacePageFile<P extends Page>
- Overrides:
logStatistics
in classAbstractPageFile<P extends Page>
-
-