com.sun.jimi.core.vmem
Class PageFrame

java.lang.Object
  |
  +--com.sun.jimi.core.vmem.PageFrame
Direct Known Subclasses:
BytePageFrame, IntPageFrame

public abstract class PageFrame
extends java.lang.Object

Base class for in-memory buffers representing pages of paged data. Maintains some useful state: Whether the data in the frame has been modified, when the page was last accessed, and which logical page it represents. Subclasses must implement the I/O code for swapping page frames to and from streams.


Field Summary
protected  int logicalPageNumber
          logical page number represented by the page frame
protected  boolean modified
          true if the page is marked as modified
protected  long timeStamp
          timestamp of last use
 
Constructor Summary
PageFrame()
           
 
Method Summary
 int getLogicalPageNumber()
          Get the logical page number this frame represents.
 boolean isModified()
          Check if the page frame has been modified in memory.
 long lastTouched()
          Return the time for when the frame was last touched.
abstract  void readFrom(java.io.InputStream input)
          Read in page data from an input stream.
 void setLogicalPageNumber(int pageNumber)
          Set the logical page number this frame represents.
 void setModified(boolean flag)
          Set whether the page frame is marked as modified
 void touch()
          Update the timestamp to the present time.
abstract  void writeTo(java.io.OutputStream output)
          Write the page to an output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modified

protected boolean modified
true if the page is marked as modified

logicalPageNumber

protected int logicalPageNumber
logical page number represented by the page frame

timeStamp

protected long timeStamp
timestamp of last use
Constructor Detail

PageFrame

public PageFrame()
Method Detail

isModified

public boolean isModified()
Check if the page frame has been modified in memory.
Returns:
true if the page is marked as modified

setModified

public void setModified(boolean flag)
Set whether the page frame is marked as modified
Parameters:
flag - true if the frame is being marked as modified

setLogicalPageNumber

public void setLogicalPageNumber(int pageNumber)
Set the logical page number this frame represents.
Parameters:
pageNumber - the logical page number

getLogicalPageNumber

public int getLogicalPageNumber()
Get the logical page number this frame represents.
Returns:
the page number

writeTo

public abstract void writeTo(java.io.OutputStream output)
                      throws java.io.IOException
Write the page to an output stream.
Parameters:
output - the stream to write to

readFrom

public abstract void readFrom(java.io.InputStream input)
                       throws java.io.IOException
Read in page data from an input stream.
Parameters:
input - the stream to read from

lastTouched

public long lastTouched()
Return the time for when the frame was last touched.
Returns:
the time as a long

touch

public void touch()
Update the timestamp to the present time.