class SimilarityStreamGenerator {

    public Stream<SimilarityResult> stream(T[] inputs, int[] sourceIndexIds, int[] targetIndexIds, double cutoff, int topK) {
        int concurrency = configuration.getConcurrency();

        int length = inputs.length;
        if (concurrency == 1) {
            if (topK != 0) {
                return similarityStreamTopK(inputs, sourceIndexIds, targetIndexIds, length, cutoff, topK, computer, decoderFactory);
            } else {
                return similarityStream(inputs, sourceIndexIds, targetIndexIds, length, cutoff, computer, decoderFactory);
            }
        } else {
            if (topK != 0) {
                return similarityParallelStreamTopK(inputs, sourceIndexIds, targetIndexIds, length, terminationFlag, concurrency, cutoff, topK, computer, decoderFactory);
            } else {
                return similarityParallelStream(inputs, sourceIndexIds, targetIndexIds, length, terminationFlag, concurrency, cutoff, computer, decoderFactory);
            }
        }
    }

    public  SimilarityStreamGenerator(TerminationFlag terminationFlag, ProcedureConfiguration configuration, Supplier<RleDecoder> decoderFactory, SimilarityComputer<T> computer);

}