<commit_before>package de.thorbenkuck.rhfw.register.handler;

import de.thorbenkuck.rhfw.register.Register;
import de.thorbenkuck.rhfw.register.RegisterID;
import de.thorbenkuck.rhfw.templates.RegisterTemplate;

import java.util.HashMap;
import java.util.List;

public class RegisterHandler {

    // Eine statische Liste alle Register, damit kein Name 2 mal vor kommt
    private static HashMap<RegisterID, Register> registerList = new HashMap<>();
    private static HashMap<String, RegisterID> boundRegisters = new HashMap<>();

    public static boolean registerIDTaken(RegisterID id) {
        return RegisterHandler.registerList.containsKey(id);
    }

    public static boolean registerBound(String legereID) {
        return RegisterHandler.boundRegisters.containsKey(legereID);
    }

    public static RegisterID pullNewRegister() {
        Register newRegister = new Register();
        RegisterHandler.registerList.put(newRegister.getRegisterId(), newRegister);
        return newRegister.getRegisterId();
    }

    public static Register pullAndGetNewRegister() {
        return RegisterHandler.registerList.get(pullNewRegister());
    }

    public static RegisterID pullNewRegister(RegisterTemplate template) {
        Register newRegister = new Register();
        RegisterID id = newRegister.getRegisterId();
        RegisterHandler.registerList.put(id, newRegister);
        List<String> classesToImplement = null;
        String legereId;

        if(!template.classesToImplementEmpyt()) {
            if(template.autoImport()) {
                classesToImplement = template.getClassesToImplement();
                for (String s : classesToImplement) {
                    RegisterHandler.registerList.get(id).fetchModuleFromPipe(s);
                }
            }
        }
        if(template.getLegereId() != null) {
            legereId = template.getLegereId();
            bindRegister(legereId, newRegister.getRegisterId());
        }

        return newRegister.getRegisterId();
    }

    public static Register pullAndGetNewRegister(RegisterTemplate template) {
        return RegisterHandler.registerList.get(pullNewRegister(template));
    }

    public static <T> T getModuleFromRegister(RegisterID registerID, String className) {
        return RegisterHandler.registerList.get(registerID).pullModule(className);
    }

    public static Register getRegisterForId(RegisterID registerID) {
        return RegisterHandler.registerList.get(registerID);
    }

    public static Register getRegisterForId(String legereId) {
        return getRegisterForId(RegisterHandler.boundRegisters.get(legereId));
    }

    public static void bindRegister(String legereID, RegisterID id) {
        RegisterHandler.boundRegisters.put(legereID, id);
    }

    public synchronized static RegisterID getRegisterID(String legereID) {
        return RegisterHandler.boundRegisters.get(legereID);
    }<commit_msg>Added missing method<commit_after>package de.thorbenkuck.rhfw.register.handler;

import de.thorbenkuck.rhfw.register.Register;
import de.thorbenkuck.rhfw.register.RegisterID;
import de.thorbenkuck.rhfw.templates.RegisterTemplate;

import java.util.HashMap;
import java.util.List;

public class RegisterHandler {

    // Eine statische Liste alle Register, damit kein Name 2 mal vor kommt
    private static HashMap<RegisterID, Register> registerList = new HashMap<>();
    private static HashMap<String, RegisterID> boundRegisters = new HashMap<>();

    public static boolean registerIDTaken(RegisterID id) {
        return RegisterHandler.registerList.containsKey(id);
    }

    public static boolean registerBound(String legereID) {
        return RegisterHandler.boundRegisters.containsKey(legereID);
    }

    public static RegisterID pullNewRegister() {
        Register newRegister = new Register();
        RegisterHandler.registerList.put(newRegister.getRegisterId(), newRegister);
        return newRegister.getRegisterId();
    }

    public static Register pullAndGetNewRegister() {
        return RegisterHandler.registerList.get(pullNewRegister());
    }

    public static RegisterID pullNewRegister(RegisterTemplate template) {
        Register newRegister = new Register();
        RegisterID id = newRegister.getRegisterId();
        RegisterHandler.registerList.put(id, newRegister);
        List<String> classesToImplement = null;
        String legereId;

        if(!template.classesToImplementEmpyt()) {
            if(template.autoImport()) {
                classesToImplement = template.getClassesToImplement();
                for (String s : classesToImplement) {
                    RegisterHandler.registerList.get(id).fetchModuleFromPipe(s);
                }
            }
        }
        if(template.getLegereId() != null) {
            legereId = template.getLegereId();
            bindRegister(legereId, newRegister.getRegisterId());
        }

        return newRegister.getRegisterId();
    }

    public static Register pullAndGetNewRegister(RegisterTemplate template) {
        return RegisterHandler.registerList.get(pullNewRegister(template));
    }

    public static <T> T getModuleFromRegister(RegisterID registerID, String className) {
        return RegisterHandler.registerList.get(registerID).pullModule(className);
    }

    public static <T> T getModuleFromRegister(String legereID, String className) {
        return getModuleFromRegister(getRegisterID(legereID), className);
    }

    public static Register getRegisterForId(RegisterID registerID) {
        return RegisterHandler.registerList.get(registerID);
    }

    public static Register getRegisterForId(String legereId) {
        return getRegisterForId(RegisterHandler.boundRegisters.get(legereId));
    }

    public static void bindRegister(String legereID, RegisterID id) {
        RegisterHandler.boundRegisters.put(legereID, id);
    }

    public synchronized static RegisterID getRegisterID(String legereID) {
        return RegisterHandler.boundRegisters.get(legereID);
    }
{'fraction_non_alphanumeric': 0.08470081219956904, 'fraction_numerical': 0.0003315100281783524, 'mean_word_length': 3.4269992663242848, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '5326995', 'n_tokens_mistral': 1565, 'n_tokens_neox': 1549, 'n_words': 327}