Class OneSizeHandlesByOid


public class OneSizeHandlesByOid
extends HandlesByOid

This particular implementation of HandlesByOid assumes all handles take the same space when they are written to disk. This size currently is 17, but if it was to change, this class can easily be extended just redefining this value (not forgetting that 1 must be added to the size to take care of the code written on one byte before every handle.

$Revision: 1.4 $
This software was produced by NIST, an agency of the U.S. government, and by statute is not subject to copyright in the United States. Recipients of this software assume all responsibilities associated with its operation, modification and maintenance.
See Also:
Serialized Form

Field Summary
protected static int handlesByOidDataEntrySize
          Assumed constant entry size for serialized Handle.
Fields inherited from class gov.nist.nlpir.irf.proxy.HandlesByOid
fileSeparator, handlesByOidAdds, handlesByOidCache, handlesByOidDataFile, handlesByOidDataFileLocation, handlesByOidGets, handlesByOidGetsFromCache, handlesByOidRemoves, handlesByOidUpdates, maxHandlesByOidCacheEntries, serialVersionUID
Constructor Summary
Method Summary
 long getHandlesByOidSize()
          Gets the size of the table
protected  Handle readHandleForOid(Oid oid)
          Reads the Handle back from the data file.
protected  void writeHandleForOid(Oid oid, Handle handle)
          Directly writes the handle at the correct offset in the data file.
Methods inherited from class gov.nist.nlpir.irf.proxy.HandlesByOid
addHandleByOid, getHandleByOid, getHandlesByOidDataFileLocation, getMaxHandlesByOidCacheEntries, getStatistics, openHandlesByOid, replaceHandleByOid, setHandlesByOidDataFileLocation, setMaxHandlesByOidCacheEntries, shutdown
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait

Field Detail


protected static int handlesByOidDataEntrySize
Assumed constant entry size for serialized Handle. It is just protected so that one may inherit this class and just redefine it if he had longer/shorter handles.
Constructor Detail


public OneSizeHandlesByOid()
Method Detail


protected final void writeHandleForOid(Oid oid,
                                       Handle handle)
Directly writes the handle at the correct offset in the data file. The offset is easily computed with a multiplication of the handlesByOidDataEntrySize variable by the OID given in parameter.
writeHandleForOid in class HandlesByOid


protected Handle readHandleForOid(Oid oid)
Reads the Handle back from the data file. The offset at which it is written is calculated by multiplying the OID by the size of a "serialized" handle, as this size is unique.
readHandleForOid in class HandlesByOid


public long getHandlesByOidSize()
Gets the size of the table
the number of keys (Oids) in the table
getHandlesByOidSize in class HandlesByOid