gov.nist.nlpir.irf.proxy
Class OneSizeHandlesByOid
java.lang.Object
|
+--gov.nist.nlpir.irf.proxy.HandlesByOid
|
+--gov.nist.nlpir.irf.proxy.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.
- Version:
- $Revision: 1.4 $
- Author:
- 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
Fields inherited from class gov.nist.nlpir.irf.proxy.HandlesByOid |
fileSeparator,
handlesByOidAdds,
handlesByOidCache,
handlesByOidDataFile,
handlesByOidDataFileLocation,
handlesByOidGets,
handlesByOidGetsFromCache,
handlesByOidRemoves,
handlesByOidUpdates,
maxHandlesByOidCacheEntries,
serialVersionUID |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
handlesByOidDataEntrySize
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.
OneSizeHandlesByOid
public OneSizeHandlesByOid()
writeHandleForOid
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.
- Overrides:
- writeHandleForOid in class HandlesByOid
readHandleForOid
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.
- Overrides:
- readHandleForOid in class HandlesByOid
getHandlesByOidSize
public long getHandlesByOidSize()
- Gets the size of the table
- Returns:
- the number of keys (Oids) in the table
- Overrides:
- getHandlesByOidSize in class HandlesByOid