org.apache.jackrabbit.core.query.lucene.sort
Class AbstractFieldComparator

java.lang.Object
  extended by org.apache.lucene.search.FieldComparator
      extended by org.apache.jackrabbit.core.query.lucene.FieldComparatorBase
          extended by org.apache.jackrabbit.core.query.lucene.sort.AbstractFieldComparator
Direct Known Subclasses:
DynamicOperandFieldComparator

public abstract class AbstractFieldComparator
extends FieldComparatorBase

Abstract base class for FieldComparators which keep their values (Comparables) in an array.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lucene.search.FieldComparator
org.apache.lucene.search.FieldComparator.ByteComparator, org.apache.lucene.search.FieldComparator.DocComparator, org.apache.lucene.search.FieldComparator.DoubleComparator, org.apache.lucene.search.FieldComparator.FloatComparator, org.apache.lucene.search.FieldComparator.IntComparator, org.apache.lucene.search.FieldComparator.LongComparator, org.apache.lucene.search.FieldComparator.RelevanceComparator, org.apache.lucene.search.FieldComparator.ShortComparator, org.apache.lucene.search.FieldComparator.StringComparatorLocale, org.apache.lucene.search.FieldComparator.StringOrdValComparator, org.apache.lucene.search.FieldComparator.StringValComparator
 
Field Summary
protected  List<org.apache.lucene.index.IndexReader> readers
          The index readers.
protected  int[] starts
          The document number starts for the readers.
 
Constructor Summary
protected AbstractFieldComparator(int numHits)
          Create a new instance with the given number of values.
 
Method Summary
protected  String getUUIDForIndex(int doc)
           
 Comparable<?> getValue(int slot)
          Return a value from the values array
protected  int readerIndex(int n)
          Returns the reader index for document n.
 void setNextReader(org.apache.lucene.index.IndexReader reader, int docBase)
           
 void setValue(int slot, Comparable<?> value)
          Add the given value to the values array
 
Methods inherited from class org.apache.jackrabbit.core.query.lucene.FieldComparatorBase
compare, compare, compareBottom, copy, setBottom, sortValue, value
 
Methods inherited from class org.apache.lucene.search.FieldComparator
binarySearch, binarySearch, setScorer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

readers

protected final List<org.apache.lucene.index.IndexReader> readers
The index readers.


starts

protected int[] starts
The document number starts for the readers.

Constructor Detail

AbstractFieldComparator

protected AbstractFieldComparator(int numHits)
Create a new instance with the given number of values.

Parameters:
numHits - the number of values
Method Detail

readerIndex

protected final int readerIndex(int n)
Returns the reader index for document n.

Parameters:
n - document number.
Returns:
the reader index.

setValue

public void setValue(int slot,
                     Comparable<?> value)
Add the given value to the values array

Specified by:
setValue in class FieldComparatorBase
Parameters:
slot - index into values
value - value for adding

getValue

public Comparable<?> getValue(int slot)
Return a value from the values array

Specified by:
getValue in class FieldComparatorBase
Parameters:
slot - index to retrieve
Returns:
the retrieved value

setNextReader

public void setNextReader(org.apache.lucene.index.IndexReader reader,
                          int docBase)
                   throws IOException
Specified by:
setNextReader in class org.apache.lucene.search.FieldComparator
Throws:
IOException

getUUIDForIndex

protected String getUUIDForIndex(int doc)
                          throws IOException
Throws:
IOException


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.