<commit_before>package uk.co.webamoeba.mockito.collections.inject;

import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/**
 * A Set of {@link CollectionOfMocksField CollectionOfMocksFields}.
 * 
 * @author <NAME>
 */
public class CollectionOfMocksFieldSet implements Iterable<CollectionOfMocksField<Collection<Object>, Object>> {

	// TODO should this set be ordered?
	private Set<CollectionOfMocksField<Collection<Object>, Object>> collectionOfMocksFields = new HashSet<CollectionOfMocksField<Collection<Object>, Object>>();

	@SuppressWarnings("rawtypes")
	public CollectionOfMocksFieldSet(CollectionOfMocksField... collections) {
		for (CollectionOfMocksField collectionOfMocksField : collections) {
			add(collectionOfMocksField);
		}
	}

	@SuppressWarnings("rawtypes")
	public CollectionOfMocksFieldSet(Collection<CollectionOfMocksField> collections) {
		for (CollectionOfMocksField collectionOfMocksField : collections) {
			add(collectionOfMocksField);
		}
	}

	/**
	 * Adds an {@link CollectionOfMocksField} to the {@link CollectionOfMocksFieldSet}. In the event that there is a
	 * matching {@link CollectionOfMocksField} an {@link IllegalArgumentException} will be thrown. Note that it is not
	 * possible to remove an {@link CollectionOfMocksField} after it has been added.
	 * 
	 * @param collectionOfMocksField
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void add(CollectionOfMocksField collectionOfMocksField) {
		if (hasMatchingInjectableCollection(collectionOfMocksField)) {
			throw new IllegalArgumentException("There is more than one CollectionOfMocks of type of collection "
					+ collectionOfMocksField.getTypeOfCollection() + " and type of element "
					+ collectionOfMocksField.getTypeOfElements());
		}
		this.collectionOfMocksFields.add(collectionOfMocksField);
	}

	/**
	 * @return The number of {@link CollectionOfMocksField InjectableCollections} held within this
	 *         {@link CollectionOfMocksFieldSet}.
	 */
	public int size() {
		return collectionOfMocksFields.size();
	}

	/**
	 * Returns an iterator allowing the caller to iterate over the {@link CollectionOfMocksField InjectableCollections}
	 * held within this {@link CollectionOfMocksFieldSet}.
	 * 
	 * @return An iterator
	 */
	public Iterator<CollectionOfMocksField<Collection<Object>, Object>> iterator() {
		return collectionOfMocksFields.iterator();
	}

	public Set<CollectionOfMocksField<Collection<Object>, Object>> asSet() {
		return new HashSet<CollectionOfMocksField<Collection<Object>, Object>>(collectionOfMocksFields);
	}

	@SuppressWarnings("rawtypes")
	private boolean hasMatchingInjectableCollection(CollectionOfMocksField collectionOfMocksField) {
		for (CollectionOfMocksField existing : collectionOfMocksFields) {
			if (collectionOfMocksField.matches(existing)) {
				return true;
			}
		}
		return false;
	}
}
<commit_msg>Remove TODO, is fine as is<commit_after>package uk.co.webamoeba.mockito.collections.inject;

import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/**
 * A Set of {@link CollectionOfMocksField CollectionOfMocksFields}.
 * 
 * @author <NAME>
 */
public class CollectionOfMocksFieldSet implements Iterable<CollectionOfMocksField<Collection<Object>, Object>> {

	private Set<CollectionOfMocksField<Collection<Object>, Object>> collectionOfMocksFields = new HashSet<CollectionOfMocksField<Collection<Object>, Object>>();

	@SuppressWarnings("rawtypes")
	public CollectionOfMocksFieldSet(CollectionOfMocksField... collections) {
		for (CollectionOfMocksField collectionOfMocksField : collections) {
			add(collectionOfMocksField);
		}
	}

	@SuppressWarnings("rawtypes")
	public CollectionOfMocksFieldSet(Collection<CollectionOfMocksField> collections) {
		for (CollectionOfMocksField collectionOfMocksField : collections) {
			add(collectionOfMocksField);
		}
	}

	/**
	 * Adds an {@link CollectionOfMocksField} to the {@link CollectionOfMocksFieldSet}. In the event that there is a
	 * matching {@link CollectionOfMocksField} an {@link IllegalArgumentException} will be thrown. Note that it is not
	 * possible to remove an {@link CollectionOfMocksField} after it has been added.
	 * 
	 * @param collectionOfMocksField
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public void add(CollectionOfMocksField collectionOfMocksField) {
		if (hasMatchingInjectableCollection(collectionOfMocksField)) {
			throw new IllegalArgumentException("There is more than one CollectionOfMocks of type of collection "
					+ collectionOfMocksField.getTypeOfCollection() + " and type of element "
					+ collectionOfMocksField.getTypeOfElements());
		}
		this.collectionOfMocksFields.add(collectionOfMocksField);
	}

	/**
	 * @return The number of {@link CollectionOfMocksField InjectableCollections} held within this
	 *         {@link CollectionOfMocksFieldSet}.
	 */
	public int size() {
		return collectionOfMocksFields.size();
	}

	/**
	 * Returns an iterator allowing the caller to iterate over the {@link CollectionOfMocksField InjectableCollections}
	 * held within this {@link CollectionOfMocksFieldSet}.
	 * 
	 * @return An iterator
	 */
	public Iterator<CollectionOfMocksField<Collection<Object>, Object>> iterator() {
		return collectionOfMocksFields.iterator();
	}

	public Set<CollectionOfMocksField<Collection<Object>, Object>> asSet() {
		return new HashSet<CollectionOfMocksField<Collection<Object>, Object>>(collectionOfMocksFields);
	}

	@SuppressWarnings("rawtypes")
	private boolean hasMatchingInjectableCollection(CollectionOfMocksField collectionOfMocksField) {
		for (CollectionOfMocksField existing : collectionOfMocksFields) {
			if (collectionOfMocksField.matches(existing)) {
				return true;
			}
		}
		return false;
	}
}

{'fraction_non_alphanumeric': 0.09420289855072464, 'fraction_numerical': 0.0, 'mean_word_length': 5.901190476190476, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, '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': '6967058', 'n_tokens_mistral': 1715, 'n_tokens_neox': 1618, 'n_words': 383}