<commit_before>package de.interseroh.report.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author <NAME> (Crowdcode)
 */
public class MultiSelectParameter<T>
		extends AbstractSelectionParameter<MultiSelectParameter<T>, List<T>> {

	private static final int MAX_VISIBLE_ROWS = 5;

	/**
	 *
	 * @return max visible rows for multiselect controls.
	 */
	public int getRowCount() {
		return (getOptions().size() <= MAX_VISIBLE_ROWS) ? getOptions().size()
				: MAX_VISIBLE_ROWS;
	}

	@Override
	public String getParameterType() {
		return "MULTISELECT";
	}

	@Override
	public void accept(ParameterVisitor visitor) {
		visitor.visit(this);
	}

	@Override
	public List<String> asRequestParameter() {
		if (!isUnset()) {
			List<String> params = new ArrayList<>(getValue().size());
			for (T value : getValue()) {
				params.add("params["+getName() + "].value=" + urlEncode(getValueAsString()));
			}
			return params;
		} else {
			return super.asRequestParameter();
		}
	}

	@Override
	public Map<String, Object> asReportParameter() {
		if (!isUnset()) {
			return new HashMap<String, Object>() {<commit_msg>Fixed NullPointerException in MultiSelectParameter<commit_after>package de.interseroh.report.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author <NAME> (Crowdcode)
 */
public class MultiSelectParameter<T>
		extends AbstractSelectionParameter<MultiSelectParameter<T>, List<T>> {

	private static final int MAX_VISIBLE_ROWS = 5;

	/**
	 *
	 * @return max visible rows for multiselect controls.
	 */
	public int getRowCount() {
		return (getOptions().size() <= MAX_VISIBLE_ROWS) ? getOptions().size()
				: MAX_VISIBLE_ROWS;
	}

	@Override
	public String getParameterType() {
		return "MULTISELECT";
	}

	@Override
	public void accept(ParameterVisitor visitor) {
		visitor.visit(this);
	}

	@Override
	public List<String> asRequestParameter() {
		if (!isUnset()) {
			List<String> params = new ArrayList<>(4);
			for (T value : getValue()) {
				params.add("params["+getName() + "].value=" + urlEncode(getValueAsString()));
			}
			return params;
		} else {
			return super.asRequestParameter();
		}
	}

	@Override
	public Map<String, Object> asReportParameter() {
		if (!isUnset()) {
			return new HashMap<String, Object>() {
{'fraction_non_alphanumeric': 0.14152936206168146, 'fraction_numerical': 0.0012674271229404308, 'mean_word_length': 4.519813519813519, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 23, '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': '7487809', 'n_tokens_mistral': 830, 'n_tokens_neox': 755, 'n_words': 173}