<commit_before>package me.coley.recaf.search;

import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.Multimaps;
import me.coley.recaf.util.ClassUtil;
import me.coley.recaf.workspace.Workspace;
import org.objectweb.asm.*;
import org.objectweb.asm.tree.*;

import java.util.*;
import java.util.function.Function;
import java.util.function.IntSupplier;
import java.util.stream.Stream;

import static org.objectweb.asm.ClassReader.*;


/**
 * Search result collector.
 *
 * @author Matt
 */
/*
 * TODO with Search API:
 *  - Method inheritance (child of given)
 *  - Smart optimization, skip certain visitor-api calls if we know our queries won't need to look there
 */
public class SearchCollector {
	public static final int ACC_NOT_FOUND = -1;
	private final ListMultimap<Query, SearchResult> results = MultimapBuilder
			.linkedHashKeys(2).arrayListValues().build();
	private final Map<Query, List<SearchResult>> resultMapView = Multimaps.asMap(results);
	private final Workspace workspace;
	private final Collection<Query> queries;

	/**
	 * Constructs a class search visitor.
	 *
	 * @param workspace
	 * 		Workspace to pull additional references from.
	 * @param queries
	 * 		Queries to check for collecting results.
	 */
	public SearchCollector(Workspace workspace, Collection<Query> queries) {
		this.workspace = workspace;
		this.queries = queries;
	}

	/**
	 * @return Map of queries to their results.
	 */
	public ListMultimap<Query, SearchResult> getResultsMap() {
		return results;
	}<commit_msg>Update search todo note on potential features<commit_after>package me.coley.recaf.search;

import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
import com.google.common.collect.Multimaps;
import me.coley.recaf.util.ClassUtil;
import me.coley.recaf.workspace.Workspace;
import org.objectweb.asm.*;
import org.objectweb.asm.tree.*;

import java.util.*;
import java.util.function.Function;
import java.util.function.IntSupplier;
import java.util.stream.Stream;

import static org.objectweb.asm.ClassReader.*;


/**
 * Search result collector.
 *
 * @author Matt
 */
/*
 * TODO with Search API:
 *  - Method inheritance (child of given)
 *  - Strings in odd places (dynamic instruction arguments)
 *  - Not internal to the API, but supply a way to handle "\uXXXX" (unicode search)
 *  - Smart optimization, skip certain visitor-api calls if we know our queries won't need to look there
 */
public class SearchCollector {
	public static final int ACC_NOT_FOUND = -1;
	private final ListMultimap<Query, SearchResult> results = MultimapBuilder
			.linkedHashKeys(2).arrayListValues().build();
	private final Map<Query, List<SearchResult>> resultMapView = Multimaps.asMap(results);
	private final Workspace workspace;
	private final Collection<Query> queries;

	/**
	 * Constructs a class search visitor.
	 *
	 * @param workspace
	 * 		Workspace to pull additional references from.
	 * @param queries
	 * 		Queries to check for collecting results.
	 */
	public SearchCollector(Workspace workspace, Collection<Query> queries) {
		this.workspace = workspace;
		this.queries = queries;
	}

	/**
	 * @return Map of queries to their results.
	 */
	public ListMultimap<Query, SearchResult> getResultsMap() {
		return results;
	}
{'fraction_non_alphanumeric': 0.10359281437125749, 'fraction_numerical': 0.0011976047904191617, 'mean_word_length': 4.414910858995138, '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': '7656903', 'n_tokens_mistral': 1016, 'n_tokens_neox': 973, 'n_words': 287}