de.lmu.ifi.dbs.elki.persistent
Class MemoryPageFile<P extends Page>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.persistent.AbstractPageFile<P>
      extended by de.lmu.ifi.dbs.elki.persistent.AbstractStoringPageFile<P>
          extended by 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.


Field Summary
private  Map<Integer,P> file
          Holds the pages.
 
Fields inherited from class de.lmu.ifi.dbs.elki.persistent.AbstractStoringPageFile
emptyPages, nextPageID, pageSize
 
Fields inherited from class de.lmu.ifi.dbs.elki.persistent.AbstractPageFile
readAccess, writeAccess
 
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 de.lmu.ifi.dbs.elki.persistent.AbstractStoringPageFile
getInnerStatistics, getNextPageID, getPageSize, initialize, setNextPageID, setPageID
 
Methods inherited from class de.lmu.ifi.dbs.elki.persistent.AbstractPageFile
close, getReadOperations, getWriteOperations, resetPageAccess, writePage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

private final Map<Integer,P extends Page> file
Holds the pages.

Constructor Detail

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
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(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 id
page - 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.


Release 0.4.0 (2011-09-20_1324)