FileDocCategorySizeDatePackage
MultipleTermPositions.javaAPI DocApache Lucene 1.4.36164Tue Mar 30 00:48:02 BST 2004org.apache.lucene.index

MultipleTermPositions

public class MultipleTermPositions extends Object implements TermPositions
Describe class MultipleTermPositions here.
author
Anders Nielsen
version
1.0

Fields Summary
private int
_doc
private int
_freq
private TermPositionsQueue
_termPositionsQueue
private IntQueue
_posList
Constructors Summary
public MultipleTermPositions(IndexReader indexReader, Term[] terms)
Creates a new MultipleTermPositions instance.

param
indexReader an IndexReader value
param
terms a Term[] value
exception
IOException if an error occurs

	List termPositions = new LinkedList();

	for (int i=0; i<terms.length; i++)
	    termPositions.add(indexReader.termPositions(terms[i]));

	_termPositionsQueue = new TermPositionsQueue(termPositions);
	_posList = new IntQueue();
    
Methods Summary
public final voidclose()
Describe close method here.

exception
IOException if an error occurs
see
TermDocs#close()

	while (_termPositionsQueue.size() > 0)
	    ((TermPositions)_termPositionsQueue.pop()).close();
    
public final intdoc()
Describe doc method here.

return
an int value
see
TermDocs#doc()

	return _doc;
    
public final intfreq()
Describe freq method here.

return
an int value
see
TermDocs#freq()

	return _freq;
    
public final booleannext()
Describe next method here.

return
a boolean value
exception
IOException if an error occurs
see
TermDocs#next()

	if (_termPositionsQueue.size() == 0)
	    return false;

	_posList.clear();
	_doc = _termPositionsQueue.peek().doc();

	TermPositions tp;
	do
	{
	    tp = _termPositionsQueue.peek();

	    for (int i=0; i<tp.freq(); i++)
		_posList.add(tp.nextPosition());

	    if (tp.next())
		_termPositionsQueue.adjustTop();
	    else
	    {
		_termPositionsQueue.pop();
		tp.close();
	    }
	}
	while (_termPositionsQueue.size() > 0 && _termPositionsQueue.peek().doc() == _doc);

	_posList.sort();
	_freq = _posList.size();

	return true;
    
public final intnextPosition()
Describe nextPosition method here.

return
an int value
exception
IOException if an error occurs
see
TermPositions#nextPosition()

	return _posList.next();
    
public intread(int[] arg0, int[] arg1)
Describe read method here.

param
arg0 an int[] value
param
arg1 an int[] value
return
an int value
exception
IOException if an error occurs
see
TermDocs#read(int[], int[])

	throw new UnsupportedOperationException();
    
public voidseek(org.apache.lucene.index.Term arg0)
Describe seek method here.

param
arg0 a Term value
exception
IOException if an error occurs
see
TermDocs#seek(Term)

	throw new UnsupportedOperationException();
    
public voidseek(org.apache.lucene.index.TermEnum termEnum)

      throw new UnsupportedOperationException();
    
public final booleanskipTo(int target)
Describe skipTo method here.

param
target an int value
return
a boolean value
exception
IOException if an error occurs
see
TermDocs#skipTo(int)

	while (target > _termPositionsQueue.peek().doc())
	{
	    TermPositions tp = (TermPositions)_termPositionsQueue.pop();

	    if (tp.skipTo(target))
		_termPositionsQueue.put(tp);
	    else
		tp.close();
	}

	return next();