Package elki.persistent
Class MemoryPageFile<P extends Page>
- java.lang.Object
-
- elki.persistent.AbstractPageFile<P>
-
- elki.persistent.AbstractStoringPageFile<P>
-
- elki.persistent.MemoryPageFile<P>
-
- Type Parameters:
P
- Page type
- All Implemented Interfaces:
PageFile<P>
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.- Since:
- 0.1
- Author:
- Elke Achtert
-
-
Field Summary
Fields Modifier and Type Field Description private it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<P>
file
Holds the pages.private static Logging
LOG
Class logger.-
Fields inherited from class elki.persistent.AbstractStoringPageFile
emptyPages, nextPageID, pageSize
-
-
Constructor Summary
Constructors Constructor Description MemoryPageFile(int pageSize)
Creates a new MemoryPageFile that is supported by a cache with the specified parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears this PageFile.void
deletePage(int pageID)
Deletes the node with the specified id from this file.protected Logging
getLogger()
Get the class logger.P
readPage(int pageID)
Reads the page with the given id from this file.protected void
writePage(int pageID, P page)
Perform the actual page write operation.-
Methods inherited from class elki.persistent.AbstractStoringPageFile
getNextPageID, getPageSize, initialize, logStatistics, setNextPageID, setPageID
-
Methods inherited from class elki.persistent.AbstractPageFile
close, countRead, countWrite, writePage
-
-
-
-
Method Detail
-
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(int pageID, P page)
Description copied from class:AbstractPageFile
Perform the actual page write operation.- Specified by:
writePage
in classAbstractPageFile<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 interfacePageFile<P extends Page>
- Overrides:
deletePage
in classAbstractStoringPageFile<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.
-
getLogger
protected Logging getLogger()
Description copied from class:AbstractPageFile
Get the class logger.- Specified by:
getLogger
in classAbstractPageFile<P extends Page>
- Returns:
- Logger
-
-