<commit_before>package de.unistuttgart.ipvs.as.flexmash.webservices.operations;

import javax.jws.*;

@WebService(name = "Filter")
/**
 * web service that joins two data sources
 */
public class Filter {

	@WebMethod(operationName = "filter")
	@WebResult(name = "key")
	/**
	 * joins two data sources
	 * 
	 * @param key
	 * 			data to be filtered
	 * @param criteria
	 * 			the filter criteria
	 * @return the filtered data
	 */
	public String filter(@WebParam(name = "key") String key1, @WebParam(name = "criteria") String criteria) {

		return null;
	}
}<commit_msg>updated filter<commit_after>package de.unistuttgart.ipvs.as.flexmash.webservices.operations;

import javax.jws.*;

import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;

@WebService(name = "Filter")
/**
 * web service that joins two data sources
 */
public class Filter {

	@WebMethod(operationName = "filter")
	@WebResult(name = "key")
	/**
	 * joins two data sources
	 * 
	 * @param key
	 *            data to be filtered
	 * @param criteria
	 *            the filter criteria
	 * @return the filtered data
	 */
	public String filter(@WebParam(name = "key") String key, @WebParam(name = "criteria") String criteria) {
		try {
			JSONParser parser = new JSONParser();
			JSONObject tableContent = (JSONObject) parser.parse(key);
			JSONArray values = (JSONArray) tableContent.get("result");

			JSONObject result = new JSONObject();

			for (int i = 0; i < values.size(); i++) {
				JSONObject currColumn = (JSONObject) values.get(i);

				Object[] keys = currColumn.keySet().toArray();
				for (int j = 0; j < keys.length; j++) {
					if (currColumn.get(keys[j]).equals(criteria)) {
						result.put("result", currColumn);
					}
				}
			}

			return result.toJSONString();

		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
}
{'fraction_non_alphanumeric': 0.1347914547304171, 'fraction_numerical': 0.001525940996948118, 'mean_word_length': 3.511467889908257, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6745241', 'n_tokens_mistral': 688, 'n_tokens_neox': 607, 'n_words': 163}