<commit_before>package com.punchline.javalib.entities;

import java.util.HashMap;
import java.util.Map;

/**
 * Holds a map of {@link Component Components} with their type identifiers, 
 * and helpful methods for accessing and manipulating them.
 * @author Nathaniel
 *
 */
public abstract class ComponentManager {

	private Map<Class<?>, Component> components = new HashMap<Class<?>, Component>(); //HashMap?
	
	/**
	 * Adds the given component to this container.
	 * @param value The component to be added.
	 */
	public void addComponent(Component value) {
		components.put(value.getClass(), value);
		value.onAdd(this);
	}

	/**
	 * Removes the given component from this container.
	 * @param value The component to be removed.
	 */
	public void removeComponent(Component value) {
		value.onRemove(this);
		components.remove(value.getClass());
	}
	
	/**
	 * @param type The desired type.
	 * @return This container's component of that type.
	 */
	@SuppressWarnings("unchecked")
	public <T extends Component> T getComponent(T... type) {
		return (T)components.get((Class<T>) type.getClass().getComponentType());
	}
	
	/**
	 * @param type The desired type.
	 * @return Whether this container has a component of that type.
	 */
	@SuppressWarnings("unchecked")
	public <T extends Component> boolean hasComponent(T... type) {
		return components.containsKey((Class<T>) type.getClass().getComponentType());
	}
	
}
<commit_msg>Reverting hasComponent<commit_after>package com.punchline.javalib.entities;

import java.util.HashMap;
import java.util.Map;

/**
 * Holds a map of {@link Component Components} with their type identifiers, 
 * and helpful methods for accessing and manipulating them.
 * @author Nathaniel
 *
 */
public abstract class ComponentManager {

	private Map<Class<?>, Component> components = new HashMap<Class<?>, Component>(); //HashMap?
	
	/**
	 * Adds the given component to this container.
	 * @param value The component to be added.
	 */
	public void addComponent(Component value) {
		components.put(value.getClass(), value);
		value.onAdd(this);
	}

	/**
	 * Removes the given component from this container.
	 * @param value The component to be removed.
	 */
	public void removeComponent(Component value) {
		value.onRemove(this);
		components.remove(value.getClass());
	}
	
	/**
	 * @param type The desired type.
	 * @return This container's component of that type.
	 */
	@SuppressWarnings("unchecked")
	public <T extends Component> T getComponent(T... type) {
		return (T)components.get((Class<T>) type.getClass().getComponentType());
	}
	
	/**
	 * @param type The desired type.
	 * @return Whether this container has a component of that type.
	 */
	public boolean hasComponent(Class<?> type){
		return components.containsKey(type);
	}
	
}

{'fraction_non_alphanumeric': 0.1248642779587405, 'fraction_numerical': 0.0, 'mean_word_length': 4.080882352941177, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '3139377', 'n_tokens_mistral': 824, 'n_tokens_neox': 779, 'n_words': 254}