<commit_before>package org.jpc.query;

import java.util.ArrayList;
import java.util.List;

import org.jpc.Jpc;
import org.jpc.engine.prolog.PrologEngine;
import org.jpc.term.Term;

import com.google.common.base.Function;
import com.google.common.base.Functions;

public class QueryAdapter extends Query {

	protected Function<Solution, Solution> adapterFunction;
	protected Query query;
	
	public QueryAdapter(Query query) {
		this(query, Functions.<Solution>identity());
	}
	
	public QueryAdapter(Query query, Function<Solution, Solution> adapterFunction) {
		this.query = query;
		this.adapterFunction = adapterFunction;
	}

	public boolean isAbortable() {
		return query.isAbortable();
	}
	
	@Override
	public Jpc getJpcContext() {
		return query.getJpcContext();
	}
	
	@Override
	public PrologEngine getPrologEngine() {
		return query.getPrologEngine();
	}
	
	@Override
	public Term getGoal() {
		return query.getGoal();
	}
	
	@Override
	public boolean isErrorHandledQuery() {
		return query.isErrorHandledQuery();
	}
	
	@Override
	protected boolean shouldVerifySolution() {
		return false;
	}
	
	@Override
	protected Term getDefaultSelectedTerm() {
		return query.getDefaultSelectedTerm();
	}
	
	@Override
	protected Solution basicOneSolutionOrThrow() {
		Solution adaptee = super.basicOneSolutionOrThrow();
		return adaptee != null?adapterFunction.apply(adaptee):null;
	}
	
	@Override
	protected List<Solution> basicAllSolutions() {
		List<Solution> allSolutions = new ArrayList<>();
		for(Solution adaptee : super.basicAllSolutions()) {
			allSolutions.add(adapterFunction.apply(adaptee));
		}
		return allSolutions;
	}
	
	@Override
	protected void basicAbort() {
		query.abort();
	}

	@Override
	protected void basicClose() {
		query.close();
	}

	@Override
	protected Solution basicNext() {
		Solution adaptee = query.next();
		return adaptee != null?adapterFunction.apply(adaptee):null;
	}

}
<commit_msg>fixed Bug in the QueryAdapter class<commit_after>package org.jpc.query;

import java.util.ArrayList;
import java.util.List;

import org.jpc.Jpc;
import org.jpc.engine.prolog.PrologEngine;
import org.jpc.term.Term;

import com.google.common.base.Function;
import com.google.common.base.Functions;

public class QueryAdapter extends Query {

	protected Function<Solution, Solution> adapterFunction;
	protected Query query;
	
	public QueryAdapter(Query query) {
		this(query, Functions.<Solution>identity());
	}
	
	public QueryAdapter(Query query, Function<Solution, Solution> adapterFunction) {
		this.query = query;
		this.adapterFunction = adapterFunction;
	}

	public boolean isAbortable() {
		return query.isAbortable();
	}
	
	@Override
	public Jpc getJpcContext() {
		return query.getJpcContext();
	}
	
	@Override
	public PrologEngine getPrologEngine() {
		return query.getPrologEngine();
	}
	
	@Override
	public Term getGoal() {
		return query.getGoal();
	}
	
	@Override
	public boolean isErrorHandledQuery() {
		return query.isErrorHandledQuery();
	}
	
	@Override
	protected boolean shouldVerifySolution() {
		return false;
	}
	
	@Override
	protected Term getDefaultSelectedTerm() {
		return query.getDefaultSelectedTerm();
	}
	
	@Override
	protected Solution basicOneSolutionOrThrow() {
		Solution adaptee = query.oneSolutionOrThrow();
		return adaptee != null?adapterFunction.apply(adaptee):null;
	}
	
	@Override
	protected List<Solution> basicAllSolutions() {
		List<Solution> allSolutions = new ArrayList<>();
		for(Solution adaptee : query.allSolutions()) {
			allSolutions.add(adapterFunction.apply(adaptee));
		}
		return allSolutions;
	}
	
	@Override
	protected void basicAbort() {
		query.abort();
	}

	@Override
	protected void basicClose() {
		query.close();
	}

	@Override
	protected Solution basicNext() {
		Solution adaptee = query.next();
		return adaptee != null?adapterFunction.apply(adaptee):null;
	}

}

{'fraction_non_alphanumeric': 0.11035918792295679, 'fraction_numerical': 0.0, 'mean_word_length': 4.876146788990826, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3425201', 'n_tokens_mistral': 1309, 'n_tokens_neox': 1178, 'n_words': 261}