Commit 97098ac2 authored by Honza Brázdil's avatar Honza Brázdil
Browse files

Make BatchKNNQueryOperation constructors more generic

Alow construction of BatchKNNQueryOperation using any Iterator,
not only StreamGenericAbstractObjectIterator
parent 714177a0
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -20,8 +20,8 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import messif.objects.LocalAbstractObject;
import messif.objects.util.AbstractObjectIterator;
import messif.objects.util.StreamGenericAbstractObjectIterator;
import messif.operations.AbstractOperation;
import messif.operations.AnswerType;
import messif.operations.OperationErrorCode;
@@ -52,7 +52,7 @@ public class BatchKNNQueryOperation extends QueryOperation {
     * @param k the number of nearest neighbors to retrieve for each operation
     */
    @AbstractOperation.OperationConstructor({"Query object", "Number of nearest objects"})
    public BatchKNNQueryOperation(StreamGenericAbstractObjectIterator queryObjects, int k) {
    public BatchKNNQueryOperation(Iterator<? extends LocalAbstractObject> queryObjects, int k) {
        this(queryObjects, k, AnswerType.NODATA_OBJECTS);
    }

@@ -63,7 +63,7 @@ public class BatchKNNQueryOperation extends QueryOperation {
     * @param answerType the type of objects this operation stores in its answer
     */
    @AbstractOperation.OperationConstructor({"Query object", "Number of nearest objects", "Answer type"})
    public BatchKNNQueryOperation(StreamGenericAbstractObjectIterator queryObjects, int k, AnswerType answerType) {
    public BatchKNNQueryOperation(Iterator<? extends LocalAbstractObject> queryObjects, int k, AnswerType answerType) {
        this(queryObjects, Integer.MAX_VALUE, k, answerType);
    }

@@ -75,7 +75,7 @@ public class BatchKNNQueryOperation extends QueryOperation {
     * @param answerType the type of objects this operation stores in its answer
     */
    @AbstractOperation.OperationConstructor({"Query object", "Number of nearest objects", "Store the meta-object subdistances?", "Answer type"})
    public BatchKNNQueryOperation(StreamGenericAbstractObjectIterator queryObjects, int maxNQueries, int k, AnswerType answerType) {
    public BatchKNNQueryOperation(Iterator<? extends LocalAbstractObject> queryObjects, int maxNQueries, int k, AnswerType answerType) {
        super(answerType);
        List<KNNQueryOperation> operations = new ArrayList<>();
        int i = 0;