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

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.persistent.AbstractPageFile<P>
Type Parameters:
P - page type
All Implemented Interfaces:
PageFile<P>, PageFileStatistics
Direct Known Subclasses:
AbstractStoringPageFile, LRUCache

public abstract class AbstractPageFile<P extends Page>
extends Object
implements PageFile<P>

Abstract base class for the page file API for both caches and true page files (in-memory and on-disk).


Field Summary
protected  long readAccess
          The read I/O-Access of this file.
protected  long writeAccess
          The write I/O-Access of this file.
 
Constructor Summary
AbstractPageFile()
          Constructor.
 
Method Summary
 void close()
          Closes this file.
 long getReadOperations()
          Returns the read I/O-Accesses of this file.
 long getWriteOperations()
          Returns the write I/O-Accesses of this file.
 void resetPageAccess()
          Resets the counters for page accesses of this file and flushes the cache.
protected abstract  void writePage(Integer pageid, P page)
          Perform the actual page write operation.
 int writePage(P page)
          Writes a page into this file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.persistent.PageFile
clear, deletePage, getNextPageID, getPageSize, initialize, readPage, setNextPageID, setPageID
 
Methods inherited from interface de.lmu.ifi.dbs.elki.persistent.PageFileStatistics
getInnerStatistics
 

Field Detail

readAccess

protected long readAccess
The read I/O-Access of this file.


writeAccess

protected long writeAccess
The write I/O-Access of this file.

Constructor Detail

AbstractPageFile

public AbstractPageFile()
Constructor.

Method Detail

writePage

public final int writePage(P page)
Writes a page into this file. The method tests if the page has already an id, otherwise a new id is assigned and returned.

Specified by:
writePage in interface PageFile<P extends Page>
Parameters:
page - the page to be written
Returns:
the id of the page

writePage

protected abstract void writePage(Integer pageid,
                                  P page)
Perform the actual page write operation.

Parameters:
pageid - Page id
page - Page to write

close

public void close()
Description copied from interface: PageFile
Closes this file.

Specified by:
close in interface PageFile<P extends Page>

getReadOperations

public final long getReadOperations()
Description copied from interface: PageFileStatistics
Returns the read I/O-Accesses of this file.

Specified by:
getReadOperations in interface PageFileStatistics
Returns:
Number of physical read I/O accesses

getWriteOperations

public final long getWriteOperations()
Description copied from interface: PageFileStatistics
Returns the write I/O-Accesses of this file.

Specified by:
getWriteOperations in interface PageFileStatistics
Returns:
Number of physical write I/O accesses

resetPageAccess

public final void resetPageAccess()
Description copied from interface: PageFileStatistics
Resets the counters for page accesses of this file and flushes the cache.

Specified by:
resetPageAccess in interface PageFileStatistics

Release 0.4.0 (2011-09-20_1324)