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>fileHolds the pages.private static LoggingLOGClass 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 voidclear()Clears this PageFile.voiddeletePage(int pageID)Deletes the node with the specified id from this file.protected LogginggetLogger()Get the class logger.PreadPage(int pageID)Reads the page with the given id from this file.protected voidwritePage(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:PageFileReads 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:AbstractPageFilePerform the actual page write operation.- Specified by:
writePagein classAbstractPageFile<P extends Page>- Parameters:
pageID- Page idpage- Page to write
-
deletePage
public void deletePage(int pageID)
Description copied from class:AbstractStoringPageFileDeletes the node with the specified id from this file.- Specified by:
deletePagein interfacePageFile<P extends Page>- Overrides:
deletePagein classAbstractStoringPageFile<P extends Page>- Parameters:
pageID- the id of the node to be deleted
-
clear
public void clear()
Description copied from interface:PageFileClears this PageFile.
-
getLogger
protected Logging getLogger()
Description copied from class:AbstractPageFileGet the class logger.- Specified by:
getLoggerin classAbstractPageFile<P extends Page>- Returns:
- Logger
-
-