edu.harvard.deas.hyperenc.vsat
Class NNPageDatabase
java.lang.Object
java.lang.Thread
edu.harvard.deas.hyperenc.vsat.NNPageDatabase
- All Implemented Interfaces:
- PageDatabase, Serializable, Runnable
public class NNPageDatabase
- extends Thread
- implements Serializable, PageDatabase
Contains an index of the pages we will provide. Does the
book-keeping to make sure that each page is only accessed twice,
returns pages based on the Nearest Neighbor lookup
- See Also:
- Serialized Form
Field Summary |
static int |
MAX_NUM_PAGES
The number of pages this database will contain |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
MAX_NUM_PAGES
public static final int MAX_NUM_PAGES
- The number of pages this database will contain
- See Also:
- Constant Field Values
NNPageDatabase
public NNPageDatabase()
- Creates a new NNPageDatabase. Generates MAX_NUM_PAGES and inserts them
into the database.
getNumPages
public int getNumPages()
- Specified by:
getNumPages
in interface PageDatabase
- Returns:
- Number of pages currently stored in the page database.
getMaxPages
public int getMaxPages()
- Specified by:
getMaxPages
in interface PageDatabase
- Returns:
- Maximum number of pages that can be stored in the page database.
getClosestPage
public byte[] getClosestPage(int key)
- Equivalent to
getPage
.
getPage
public byte[] getPage(int key)
- Use the key to return the closest available page.
- Specified by:
getPage
in interface PageDatabase
- Parameters:
key
- The key we are trying to match.
- Returns:
- The page whose key was closest to the request, or
null
if the database is empty.