mirror of https://github.com/apache/lucene.git
move class to o.a.l.index and make pkg-private, silence java7 warnings
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1372456 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6331d4be67
commit
f08b7105b4
|
@ -24,7 +24,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.util.MergedIterator;
|
||||
import org.apache.lucene.index.BufferedDeletesStream.QueryAndLimit;
|
||||
|
||||
class CoalescedDeletes {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.lucene.util;
|
||||
package org.apache.lucene.index;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
|
@ -20,6 +20,8 @@ package org.apache.lucene.util;
|
|||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.apache.lucene.util.PriorityQueue;
|
||||
|
||||
/**
|
||||
* Provides a merged sorted view from several sorted iterators, each
|
||||
* iterating over a unique set of elements.
|
||||
|
@ -39,13 +41,13 @@ import java.util.NoSuchElementException;
|
|||
* </ul>
|
||||
* @lucene.internal
|
||||
*/
|
||||
public class MergedIterator<T extends Comparable<T>> implements Iterator<T> {
|
||||
final class MergedIterator<T extends Comparable<T>> implements Iterator<T> {
|
||||
private T current;
|
||||
private final TermMergeQueue<T> queue;
|
||||
private final SubIterator<T>[] top;
|
||||
private int numTop;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked","rawtypes"})
|
||||
public MergedIterator(Iterator<T>... iterators) {
|
||||
queue = new TermMergeQueue<T>(iterators.length);
|
||||
top = new SubIterator[iterators.length];
|
|
@ -28,7 +28,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
|
||||
import org.apache.lucene.util.Bits;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.MergedIterator;
|
||||
|
||||
/**
|
||||
* Exposes flex API, merged from flex API of sub-segments.
|
||||
|
@ -182,7 +181,7 @@ public final class MultiFields extends Fields {
|
|||
this.subSlices = subSlices;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked","rawtypes"})
|
||||
@Override
|
||||
public Iterator<String> iterator() {
|
||||
Iterator<String> subIterators[] = new Iterator[subs.length];
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.util.Set;
|
|||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.util.MergedIterator;
|
||||
import org.apache.lucene.util._TestUtil;
|
||||
|
||||
public class TestPrefixCodedTerms extends LuceneTestCase {
|
||||
|
@ -70,14 +69,10 @@ public class TestPrefixCodedTerms extends LuceneTestCase {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testMergeEmpty() {
|
||||
List<Iterator<Term>> subs = Collections.emptyList();
|
||||
Iterator<Term> merged = new MergedIterator<Term>(subs.toArray(new Iterator[0]));
|
||||
Iterator<Term> merged = new MergedIterator<Term>();
|
||||
assertFalse(merged.hasNext());
|
||||
|
||||
subs = new ArrayList<Iterator<Term>>();
|
||||
subs.add(new PrefixCodedTerms.Builder().finish().iterator());
|
||||
subs.add(new PrefixCodedTerms.Builder().finish().iterator());
|
||||
merged = new MergedIterator<Term>(subs.toArray(new Iterator[0]));
|
||||
merged = new MergedIterator<Term>(new PrefixCodedTerms.Builder().finish().iterator(), new PrefixCodedTerms.Builder().finish().iterator());
|
||||
assertFalse(merged.hasNext());
|
||||
}
|
||||
|
||||
|
@ -93,18 +88,14 @@ public class TestPrefixCodedTerms extends LuceneTestCase {
|
|||
b2.add(t2);
|
||||
PrefixCodedTerms pb2 = b2.finish();
|
||||
|
||||
List<Iterator<Term>> subs = new ArrayList<Iterator<Term>>();
|
||||
subs.add(pb1.iterator());
|
||||
subs.add(pb2.iterator());
|
||||
|
||||
Iterator<Term> merged = new MergedIterator<Term>(subs.toArray(new Iterator[0]));
|
||||
Iterator<Term> merged = new MergedIterator<Term>(pb1.iterator(), pb2.iterator());
|
||||
assertTrue(merged.hasNext());
|
||||
assertEquals(t1, merged.next());
|
||||
assertTrue(merged.hasNext());
|
||||
assertEquals(t2, merged.next());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"unchecked","rawtypes"})
|
||||
public void testMergeRandom() {
|
||||
PrefixCodedTerms pb[] = new PrefixCodedTerms[_TestUtil.nextInt(random(), 2, 10)];
|
||||
Set<Term> superSet = new TreeSet<Term>();
|
||||
|
|
Loading…
Reference in New Issue