<commit_before>package de.retest.recheck.review.ignore.matcher;

import static java.util.stream.Collectors.toCollection;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.MatchResult;
import java.util.regex.Pattern;
import java.util.stream.Stream;

import de.retest.recheck.review.ignore.io.RegexLoader;
import de.retest.recheck.ui.descriptors.Element;

public class ElementClassMatcher implements Matcher<Element> {

	public static final String CLASS_KEY = "class";

	private final Set<String> classValues;

	public ElementClassMatcher( final Element element ) {
		this( toClassValuesSet( toClassValueString( element ) ) );
	}

	private ElementClassMatcher( final Set<String> classValues ) {
		this.classValues = classValues;
	}

	@Override
	public boolean test( final Element element ) {
		final Set<String> classValues = toClassValuesSet( toClassValueString( element ) );
		if ( classValues.isEmpty() ) {
			return false;
		}
		return this.classValues.containsAll( classValues );
	}

	@Override
	public String toString() {
		return String.format( ElementClassMatcherLoader.FORMAT, classValues );
	}

	public static final class ElementClassMatcherLoader extends RegexLoader<ElementClassMatcher> {<commit_msg>Fix string representation<commit_after>package de.retest.recheck.review.ignore.matcher;

import static java.util.stream.Collectors.toCollection;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.MatchResult;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import de.retest.recheck.review.ignore.io.RegexLoader;
import de.retest.recheck.ui.descriptors.Element;

public class ElementClassMatcher implements Matcher<Element> {

	public static final String CLASS_KEY = "class";

	private final Set<String> classValues;

	public ElementClassMatcher( final Element element ) {
		this( toClassValuesSet( toClassValueString( element ) ) );
	}

	private ElementClassMatcher( final Set<String> classValues ) {
		this.classValues = classValues;
	}

	@Override
	public boolean test( final Element element ) {
		final Set<String> classValues = toClassValuesSet( toClassValueString( element ) );
		if ( classValues.isEmpty() ) {
			return false;
		}
		return this.classValues.containsAll( classValues );
	}

	@Override
	public String toString() {
		final String classValueString = classValues.stream().collect( Collectors.joining( " " ) );
		return String.format( ElementClassMatcherLoader.FORMAT, classValueString );
	}

	public static final class ElementClassMatcherLoader extends RegexLoader<ElementClassMatcher> {
{'fraction_non_alphanumeric': 0.0947565543071161, 'fraction_numerical': 0.0, 'mean_word_length': 5.467312348668281, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '1222344', 'n_tokens_mistral': 793, 'n_tokens_neox': 761, 'n_words': 183}