FileDocCategorySizeDatePackage
DefaultSkipListReader.javaAPI DocApache Lucene 2.2.03934Sat Jun 16 22:20:36 BST 2007org.apache.lucene.index

DefaultSkipListReader

public class DefaultSkipListReader extends MultiLevelSkipListReader
Implements the skip list reader for the default posting list format that stores positions and payloads.

Fields Summary
private boolean
currentFieldStoresPayloads
private long[]
freqPointer
private long[]
proxPointer
private int[]
payloadLength
private long
lastFreqPointer
private long
lastProxPointer
private int
lastPayloadLength
Constructors Summary
DefaultSkipListReader(IndexInput skipStream, int maxSkipLevels, int skipInterval)

    super(skipStream, maxSkipLevels, skipInterval);
    freqPointer = new long[maxSkipLevels];
    proxPointer = new long[maxSkipLevels];
    payloadLength = new int[maxSkipLevels];
  
Methods Summary
longgetFreqPointer()
Returns the freq pointer of the doc to which the last call of {@link MultiLevelSkipListReader#skipTo(int)} has skipped.

    return lastFreqPointer;
  
intgetPayloadLength()
Returns the payload length of the payload stored just before the doc to which the last call of {@link MultiLevelSkipListReader#skipTo(int)} has skipped.

    return lastPayloadLength;
  
longgetProxPointer()
Returns the prox pointer of the doc to which the last call of {@link MultiLevelSkipListReader#skipTo(int)} has skipped.

    return lastProxPointer;
  
voidinit(long skipPointer, long freqBasePointer, long proxBasePointer, int df, boolean storesPayloads)

    super.init(skipPointer, df);
    this.currentFieldStoresPayloads = storesPayloads;
    lastFreqPointer = freqBasePointer;
    lastProxPointer = proxBasePointer;

    Arrays.fill(freqPointer, freqBasePointer);
    Arrays.fill(proxPointer, proxBasePointer);
    Arrays.fill(payloadLength, 0);
  
protected intreadSkipData(int level, org.apache.lucene.store.IndexInput skipStream)

    int delta;
    if (currentFieldStoresPayloads) {
      // the current field stores payloads.
      // if the doc delta is odd then we have
      // to read the current payload length
      // because it differs from the length of the
      // previous payload
      delta = skipStream.readVInt();
      if ((delta & 1) != 0) {
        payloadLength[level] = skipStream.readVInt();
      }
      delta >>>= 1;
    } else {
      delta = skipStream.readVInt();
    }
    freqPointer[level] += skipStream.readVInt();
    proxPointer[level] += skipStream.readVInt();
    
    return delta;
  
protected voidseekChild(int level)

    super.seekChild(level);
    freqPointer[level] = lastFreqPointer;
    proxPointer[level] = lastProxPointer;
    payloadLength[level] = lastPayloadLength;
  
protected voidsetLastSkipData(int level)

    super.setLastSkipData(level);
    lastFreqPointer = freqPointer[level];
    lastProxPointer = proxPointer[level];
    lastPayloadLength = payloadLength[level];