org.apache.lucene.util.packed
Class EliasFanoDecoder

java.lang.Object
  extended by org.apache.lucene.util.packed.EliasFanoDecoder

public class EliasFanoDecoder
extends Object

A decoder for an EliasFanoEncoder.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

Field Summary
static long NO_MORE_VALUES
           
 
Constructor Summary
EliasFanoDecoder(EliasFanoEncoder efEncoder)
          Construct a decoder for a given EliasFanoEncoder.
 
Method Summary
 boolean advanceToIndex(long index)
          Advance the decoding index to a given index.
 long advanceToValue(long target)
          Given a target value, advance the decoding index to the first bigger or equal value and return it if it is available.
 long backToValue(long target)
          Given a target value, go back to the first smaller or equal value and return it if it is available.
 EliasFanoEncoder getEliasFanoEncoder()
          Return the Elias-Fano encoder that is decoded.
 long index()
          Return the index of the last decoded value.
 long nextValue()
          If another value is available after the current decoding index, return this value and and increase the decoding index by 1.
 long previousValue()
          If another value is available before the current decoding index, return this value and and decrease the decoding index by 1.
 void toAfterSequence()
          Set the decoding index to just after the last encoded value.
 void toBeforeSequence()
          Set the decoding index to just before the first encoded value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_MORE_VALUES

public static final long NO_MORE_VALUES
See Also:
Constant Field Values
Constructor Detail

EliasFanoDecoder

public EliasFanoDecoder(EliasFanoEncoder efEncoder)
Construct a decoder for a given EliasFanoEncoder. The decoding index is set to just before the first encoded value.

Method Detail

getEliasFanoEncoder

public EliasFanoEncoder getEliasFanoEncoder()
Return the Elias-Fano encoder that is decoded.


index

public long index()
Return the index of the last decoded value. The first value encoded by EliasFanoEncoder.encodeNext(long) has index 0. Only valid directly after nextValue(), advanceToValue(long), previousValue(), or backToValue(long) returned another value than NO_MORE_VALUES.


toBeforeSequence

public void toBeforeSequence()
Set the decoding index to just before the first encoded value.


nextValue

public long nextValue()
If another value is available after the current decoding index, return this value and and increase the decoding index by 1. Otherwise return NO_MORE_VALUES.


advanceToIndex

public boolean advanceToIndex(long index)
Advance the decoding index to a given index. and return true iff it is available.


advanceToValue

public long advanceToValue(long target)
Given a target value, advance the decoding index to the first bigger or equal value and return it if it is available. Otherwise return NO_MORE_VALUES.


toAfterSequence

public void toAfterSequence()
Set the decoding index to just after the last encoded value.


previousValue

public long previousValue()
If another value is available before the current decoding index, return this value and and decrease the decoding index by 1. Otherwise return NO_MORE_VALUES.


backToValue

public long backToValue(long target)
Given a target value, go back to the first smaller or equal value and return it if it is available. Otherwise return NO_MORE_VALUES.



Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.