org.apache.jackrabbit.core.query.lucene
Class FieldComparatorBase

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

public abstract class FieldComparatorBase
extends org.apache.lucene.search.FieldComparator

Abstract base class for FieldComparator implementations which are based on values in the form of Comparables.


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
 
Constructor Summary
FieldComparatorBase()
           
 
Method Summary
protected  int compare(Comparable<?> val1, Comparable<?> val2)
          Compare two values
 int compare(int slot1, int slot2)
           
 int compareBottom(int doc)
           
 void copy(int slot, int doc)
           
protected abstract  Comparable<?> getValue(int slot)
          Retrieves the value of a given slot
 void setBottom(int slot)
           
protected abstract  void setValue(int slot, Comparable<?> value)
          Puts a value into a given slot
protected abstract  Comparable<?> sortValue(int doc)
          Value for a document
 Comparable<?> value(int slot)
           
 
Methods inherited from class org.apache.lucene.search.FieldComparator
binarySearch, binarySearch, setNextReader, setScorer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldComparatorBase

public FieldComparatorBase()
Method Detail

sortValue

protected abstract Comparable<?> sortValue(int doc)
Value for a document

Parameters:
doc - id of the document
Returns:
the value for the given id

getValue

protected abstract Comparable<?> getValue(int slot)
Retrieves the value of a given slot

Parameters:
slot - index of the value to retrieve
Returns:
the value in the given slot

setValue

protected abstract void setValue(int slot,
                                 Comparable<?> value)
Puts a value into a given slot

Parameters:
slot - index where to put the value
value - the value to put into the given slot

compare

public int compare(int slot1,
                   int slot2)
Specified by:
compare in class org.apache.lucene.search.FieldComparator

compareBottom

public int compareBottom(int doc)
                  throws IOException
Specified by:
compareBottom in class org.apache.lucene.search.FieldComparator
Throws:
IOException

setBottom

public void setBottom(int slot)
Specified by:
setBottom in class org.apache.lucene.search.FieldComparator

compare

protected int compare(Comparable<?> val1,
                      Comparable<?> val2)
Compare two values

Parameters:
val1 - first value
val2 - second value
Returns:
A negative integer if val1 comes before val2, a positive integer if val1 comes after val2 and 0 if val1 and val2 are equal.

copy

public void copy(int slot,
                 int doc)
          throws IOException
Specified by:
copy in class org.apache.lucene.search.FieldComparator
Throws:
IOException

value

public Comparable<?> value(int slot)
Specified by:
value in class org.apache.lucene.search.FieldComparator


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