<commit_before>package com.modthemod.modthemod.property;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;

import com.modthemod.api.base.Base;
import com.modthemod.api.event.EventType;
import com.modthemod.api.mod.Mod;
import com.modthemod.api.property.Matcher;
import com.modthemod.api.property.Primitive;
import com.modthemod.api.property.Type;
import com.modthemod.api.property.TypeManager;
import com.modthemod.modthemod.MGame;

public class MTypeManager implements TypeManager {
	private final MGame game;

	private Map<String, Primitive<?>> primitives = new HashMap<String, Primitive<?>>();

	private Map<Mod, Map<String, Base>> bases = new HashMap<Mod, Map<String, Base>>();

	private Map<String, Base> baseNames = new HashMap<String, Base>();

	public MTypeManager(MGame game) {
		this.game = game;
	}

	@Override
	public Matcher getMatcher(String name) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Type<?> getType(String name) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void registerPrimitive(Primitive<?> primitive) {
		primitives.put(primitive.getName(), primitive);
	}

	@Override
	public void registerBase(Base base) {
		Map<String, Base> map = getBaseMap(base.getMod());
		Base exists = map.get(base.getName());
		if (exists != null) {
			game.getLogger().log(
					Level.WARNING,
					"Base '" + exists.getName()
							+ "' already exists! Be careful!");
		}
		map.put(base.getName(), base);<commit_msg>Implemented getType.<commit_after>package com.modthemod.modthemod.property;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.regex.Pattern;

import com.modthemod.api.base.Base;
import com.modthemod.api.mod.Mod;
import com.modthemod.api.property.Matcher;
import com.modthemod.api.property.Primitive;
import com.modthemod.api.property.Type;
import com.modthemod.api.property.TypeManager;
import com.modthemod.modthemod.MGame;

public class MTypeManager implements TypeManager {
	private static final Pattern basePattern = Pattern
			.compile("\\(([a-z,]+)\\)");

	private final MGame game;

	private Map<String, Primitive<?>> primitives = new HashMap<String, Primitive<?>>();

	private Map<Mod, Map<String, Base>> bases = new HashMap<Mod, Map<String, Base>>();

	private Map<String, Base> baseNames = new HashMap<String, Base>();

	public MTypeManager(MGame game) {
		this.game = game;
	}

	@Override
	public Matcher getMatcher(String name) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Type<?> getType(String name) {
		String baseName = basePattern.matcher(name).group();
		if (!baseName.isEmpty() && baseName != null && name.matches("[a-z]+")) {
			return baseNames.get(baseName);
		}
		return primitives.get(name);
	}

	@Override
	public void registerPrimitive(Primitive<?> primitive) {
		primitives.put(primitive.getName(), primitive);
	}

	@Override
	public void registerBase(Base base) {
		Map<String, Base> map = getBaseMap(base.getMod());
		Base exists = map.get(base.getName());
		if (exists != null) {
			game.getLogger().log(
					Level.WARNING,
					"Base '" + exists.getName()
							+ "' already exists! Be careful!");
		}
		map.put(base.getName(), base);
{'fraction_non_alphanumeric': 0.140625, 'fraction_numerical': 0.0, 'mean_word_length': 4.639032815198618, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '5395602', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1050, 'n_words': 243}