de.lmu.ifi.dbs.elki.persistent
Class MemoryPageFile<P extends Page>
java.lang.Object
de.lmu.ifi.dbs.elki.persistent.AbstractPageFile<P>
de.lmu.ifi.dbs.elki.persistent.AbstractStoringPageFile<P>
de.lmu.ifi.dbs.elki.persistent.MemoryPageFile<P>
- Type Parameters:
P
- Page type
- All Implemented Interfaces:
- PageFile<P>, PageFileStatistics
public class MemoryPageFile<P extends Page>
- extends AbstractStoringPageFile<P>
A memory based implementation of a PageFile that simulates I/O-access.
Implemented as a Map with keys representing the ids of the saved pages.
Constructor Summary |
MemoryPageFile(int pageSize)
Creates a new MemoryPageFile that is supported by a cache with the
specified parameters. |
Method Summary |
void |
clear()
Clears this PageFile. |
void |
deletePage(int pageID)
Deletes the node with the specified id from this file. |
P |
readPage(int pageID)
Reads the page with the given id from this file. |
protected void |
writePage(Integer pageID,
P page)
Perform the actual page write operation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
file
private final Map<Integer,P extends Page> file
- Holds the pages.
MemoryPageFile
public MemoryPageFile(int pageSize)
- Creates a new MemoryPageFile that is supported by a cache with the
specified parameters.
- Parameters:
pageSize
- the size of a page in Bytes
readPage
public P readPage(int pageID)
- Description copied from interface:
PageFile
- Reads the page with the given id from this file.
- Parameters:
pageID
- the id of the page to be returned
- Returns:
- the page with the given pageId
writePage
protected void writePage(Integer pageID,
P page)
- Description copied from class:
AbstractPageFile
- Perform the actual page write operation.
- Specified by:
writePage
in class AbstractPageFile<P extends Page>
- Parameters:
pageID
- Page idpage
- Page to write
deletePage
public void deletePage(int pageID)
- Description copied from class:
AbstractStoringPageFile
- Deletes the node with the specified id from this file.
- Specified by:
deletePage
in interface PageFile<P extends Page>
- Overrides:
deletePage
in class AbstractStoringPageFile<P extends Page>
- Parameters:
pageID
- the id of the node to be deleted
clear
public void clear()
- Description copied from interface:
PageFile
- Clears this PageFile.