com.sun.labs.minion.indexer.partition
Class DocEntryMapper

java.lang.Object
  extended by com.sun.labs.minion.indexer.partition.DocEntryMapper
All Implemented Interfaces:
EntryMapper

public class DocEntryMapper
extends java.lang.Object
implements EntryMapper

A class that can be used to remap document IDs when merging dictionaries composed of document keys. The IDs for the document keys will be mapped from the IDs of their original partition to the IDs of the merged partition.


Field Summary
protected  int[] idMap
          A mapping from old document IDs to new document IDs in this partition when garbage collection will occur.
protected  int start
          The new starting ID for the document keys from this partition.
 
Constructor Summary
DocEntryMapper(int start, int[] idMap)
          Creates a entry mapper for the documents from one partition.
 
Method Summary
 Entry map(Entry e)
          Maps a entry from a single partition document dictionary to a merged partition document dictionary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

start

protected int start
The new starting ID for the document keys from this partition. This will be used when there is no garbage collection going on for the partition.


idMap

protected int[] idMap
A mapping from old document IDs to new document IDs in this partition when garbage collection will occur. A new ID of -1 indicates that the given key will not occur in the merged partition. If there is no garbage collection for this partition, this will be null

Constructor Detail

DocEntryMapper

public DocEntryMapper(int start,
                      int[] idMap)
Creates a entry mapper for the documents from one partition.

Parameters:
start - The new starting ID for the document keys from this partition. This will be used when there is no garbage collection going on for the partition.
idMap - A mapping from old document IDs to new document IDs in this partition when garbage collection will occur. A new ID of -1 indicates that the given key will not occur in the merged partition. If there is no garbage collection under way for this partition, then this element can be null.
Method Detail

map

public Entry map(Entry e)
Maps a entry from a single partition document dictionary to a merged partition document dictionary. This will remap the document's ID to an ID in the merged partition.

Specified by:
map in interface EntryMapper
Parameters:
e - The entry to map.
Returns:
The mapped entry, or null if this entry should not be included in a merged dictionary. It is up to classes using the entry mapper to account for this case!