LUCENE-3850: Removed some of the rawtypes compiler warnings

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1298329 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Martijn van Groningen 2012-03-08 09:46:37 +00:00
parent 5f3053fa09
commit 37ae8ac167
6 changed files with 17 additions and 16 deletions

View File

@ -60,6 +60,7 @@ abstract public class AbstractFirstPassGroupingCollector<GROUP_VALUE_TYPE> exten
* @param topNGroups How many top groups to keep.
* @throws IOException If I/O related errors occur
*/
@SuppressWarnings({"unchecked","rawtypes"})
public AbstractFirstPassGroupingCollector(Sort groupSort, int topNGroups) throws IOException {
if (topNGroups < 1) {
throw new IllegalArgumentException("topNGroups must be >= 1 (got " + topNGroups + ")");
@ -284,7 +285,7 @@ abstract public class AbstractFirstPassGroupingCollector<GROUP_VALUE_TYPE> exten
if (orderedGroups != null) {
orderedGroups.add(group);
assert orderedGroups.size() == topNGroups;
final CollectedSearchGroup newLast = orderedGroups.last();
final CollectedSearchGroup<?> newLast = orderedGroups.last();
// If we changed the value of the last group, or changed which group was last, then update bottom:
if (group == newLast || prevLast != newLast) {
for (FieldComparator<?> fc : comparators) {
@ -295,8 +296,8 @@ abstract public class AbstractFirstPassGroupingCollector<GROUP_VALUE_TYPE> exten
}
private void buildSortedSet() {
final Comparator<CollectedSearchGroup> comparator = new Comparator<CollectedSearchGroup>() {
public int compare(CollectedSearchGroup o1, CollectedSearchGroup o2) {
final Comparator<CollectedSearchGroup<?>> comparator = new Comparator<CollectedSearchGroup<?>>() {
public int compare(CollectedSearchGroup<?> o1, CollectedSearchGroup<?> o2) {
for (int compIDX = 0;; compIDX++) {
FieldComparator<?> fc = comparators[compIDX];
final int c = reversed[compIDX] * fc.compare(o1.comparatorSlot, o2.comparatorSlot);

View File

@ -66,7 +66,7 @@ public abstract class AbstractSecondPassGroupingCollector<GROUP_VALUE_TYPE> exte
for (SearchGroup<GROUP_VALUE_TYPE> group : groups) {
//System.out.println(" prep group=" + (group.groupValue == null ? "null" : group.groupValue.utf8ToString()));
final TopDocsCollector collector;
final TopDocsCollector<?> collector;
if (withinGroupSort == null) {
// Sort by score
collector = TopScoreDocCollector.create(maxDocsPerGroup, true);
@ -124,7 +124,7 @@ public abstract class AbstractSecondPassGroupingCollector<GROUP_VALUE_TYPE> exte
final GroupDocs<GROUP_VALUE_TYPE>[] groupDocsResult = (GroupDocs<GROUP_VALUE_TYPE>[]) new GroupDocs[groups.size()];
int groupIDX = 0;
for(SearchGroup group : groups) {
for(SearchGroup<?> group : groups) {
final SearchGroupDocs<GROUP_VALUE_TYPE> groupDocs = groupMap.get(group.groupValue);
final TopDocs topDocs = groupDocs.collector.topDocs(withinGroupOffset, maxDocsPerGroup);
groupDocsResult[groupIDX++] = new GroupDocs<GROUP_VALUE_TYPE>(topDocs.getMaxScore(),
@ -146,9 +146,9 @@ public abstract class AbstractSecondPassGroupingCollector<GROUP_VALUE_TYPE> exte
public class SearchGroupDocs<GROUP_VALUE_TYPE> {
public final GROUP_VALUE_TYPE groupValue;
public final TopDocsCollector collector;
public final TopDocsCollector<?> collector;
public SearchGroupDocs(GROUP_VALUE_TYPE groupValue, TopDocsCollector collector) {
public SearchGroupDocs(GROUP_VALUE_TYPE groupValue, TopDocsCollector<?> collector) {
this.groupValue = groupValue;
this.collector = collector;
}

View File

@ -254,7 +254,7 @@ public class BlockGroupingCollector extends Collector {
this.topNGroups = topNGroups;
final SortField[] sortFields = groupSort.getSort();
comparators = new FieldComparator[sortFields.length];
comparators = new FieldComparator<?>[sortFields.length];
compIDXEnd = comparators.length - 1;
reversed = new int[sortFields.length];
for (int i = 0; i < sortFields.length; i++) {
@ -290,7 +290,7 @@ public class BlockGroupingCollector extends Collector {
* @param fillSortFields If true then the Comparable
* values for the sort fields will be set
*/
public TopGroups getTopGroups(Sort withinGroupSort, int groupOffset, int withinGroupOffset, int maxDocsPerGroup, boolean fillSortFields) throws IOException {
public TopGroups<?> getTopGroups(Sort withinGroupSort, int groupOffset, int withinGroupOffset, int maxDocsPerGroup, boolean fillSortFields) throws IOException {
//if (queueFull) {
//System.out.println("getTopGroups groupOffset=" + groupOffset + " topNGroups=" + topNGroups);
@ -339,7 +339,7 @@ public class BlockGroupingCollector extends Collector {
final Object[] groupSortValues;
if (fillSortFields) {
groupSortValues = new Comparable[comparators.length];
groupSortValues = new Comparable<?>[comparators.length];
for(int sortFieldIDX=0;sortFieldIDX<comparators.length;sortFieldIDX++) {
groupSortValues[sortFieldIDX] = comparators[sortFieldIDX].value(og.comparatorSlot);
}

View File

@ -51,7 +51,7 @@ public class SearchGroup<GROUP_VALUE_TYPE> {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SearchGroup that = (SearchGroup) o;
SearchGroup<?> that = (SearchGroup<?>) o;
if (groupValue == null) {
if (that.groupValue != null) {
@ -113,7 +113,7 @@ public class SearchGroup<GROUP_VALUE_TYPE> {
// Only for assert
private boolean neverEquals(Object _other) {
if (_other instanceof MergedGroup) {
MergedGroup other = (MergedGroup) _other;
MergedGroup<?> other = (MergedGroup<?>) _other;
if (groupValue == null) {
assert other.groupValue != null;
} else {
@ -130,7 +130,7 @@ public class SearchGroup<GROUP_VALUE_TYPE> {
assert neverEquals(_other);
if (_other instanceof MergedGroup) {
MergedGroup other = (MergedGroup) _other;
MergedGroup<?> other = (MergedGroup<?>) _other;
if (groupValue == null) {
return other == null;
} else {
@ -158,7 +158,7 @@ public class SearchGroup<GROUP_VALUE_TYPE> {
public GroupComparator(Sort groupSort) throws IOException {
final SortField[] sortFields = groupSort.getSort();
comparators = new FieldComparator[sortFields.length];
comparators = new FieldComparator<?>[sortFields.length];
reversed = new int[sortFields.length];
for (int compIDX = 0; compIDX < sortFields.length; compIDX++) {
final SortField sortField = sortFields[compIDX];

View File

@ -124,7 +124,7 @@ public class TopGroups<GROUP_VALUE_TYPE> {
for(int shardIDX=0;shardIDX<shardGroups.length;shardIDX++) {
//System.out.println(" shard=" + shardIDX);
final TopGroups<T> shard = shardGroups[shardIDX];
final GroupDocs shardGroupDocs = shard.groups[groupIDX];
final GroupDocs<?> shardGroupDocs = shard.groups[groupIDX];
if (groupValue == null) {
if (shardGroupDocs.groupValue != null) {
throw new IllegalArgumentException("group values differ across shards; you must pass same top groups to all shards' second-pass collector");

View File

@ -33,7 +33,7 @@ import java.util.*;
*
* @lucene.experimental
*/
public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHeadsCollector.GroupHead> extends AbstractAllGroupHeadsCollector<GH> {
public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHeadsCollector.GroupHead<?>> extends AbstractAllGroupHeadsCollector<GH> {
private static final int DEFAULT_INITIAL_SIZE = 128;