<commit_before>package processes;

import Commands.BaseCommand;
import Commands.Help;
import database_objects.AutocompleteTableRow;
import database_objects.CommandsTableRow;
import database_objects.PlayersTableRow;
import objects.*;
import interface_objects.*;

import javax.swing.*;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class Worker {
    // region static variables
    public static CommandRequest requestToHandle;
    public static ThreadedJobFactory threadFactory = new ThreadedJobFactory(Parameters.maxWorkerThreads);
    public static ConcurrentHashMap<String, Command> commandList = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Command> allCommands = new ConcurrentHashMap<>();
    // endregion

    // region public variables
    public CommandRequest request;
    public String error;
    public List<String> commands;
    public List<Argument> arguments;
    public boolean initCommand = false;
    // endregion

    // static initializer (all system commands)
    static {
        // help
        addSystemCommand(Parameters.CommandNameHelp, new Help(), true);
        // help.commands
        addSystemCommand(Parameters.CommandNameHelpCommands, new Help(), false);
        // TODO : add implementation for the commands
    }

    /**
     * created and adds a system command to the lists
     * @param name the name of hte ocmmamd
     * @param baseCommand the class that implements the command
     */
    public static void addSystemCommand(String name, BaseCommand baseCommand, boolean mainCommand) {
        Command cmd = new Command(0, name, baseCommand, CommandAccess.System);
        allCommands.put(cmd.name, cmd);
        if (mainCommand)
            commandList.put(cmd.name, cmd);
    }

    /**
     * entry point for worker process
     * @param args<commit_msg>added basic domain stuff to worker<commit_after>package processes;

import Commands.BaseCommand;
import Commands.Help;
import Domains.Bank;
import Domains.BaseDomain;
import database_objects.AutocompleteTableRow;
import database_objects.CommandsTableRow;
import database_objects.PlayersTableRow;
import objects.*;
import interface_objects.*;

import javax.swing.*;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class Worker {
    // region static variables
    public static CommandRequest requestToHandle;
    public static ThreadedJobFactory threadFactory = new ThreadedJobFactory(Parameters.maxWorkerThreads);
    public static ConcurrentHashMap<String, Command> commandList = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Command> allCommands = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, BaseDomain> allDomains = new ConcurrentHashMap<>();
    public static ConcurrentHashMap<String, Bank> bankDomains = new ConcurrentHashMap<>();
    // TODO : add domain manager and command manager, worker is not responsible for them
    // endregion

    // region public variables
    public CommandRequest request;
    public String error;
    public List<String> commands;
    public List<Argument> arguments;
    public boolean initCommand = false;
    // endregion

    // system commands initializer
    static {
        // help
        addSystemCommand(Parameters.CommandNameHelp, new Help(), true);
        // help.commands
        addSystemCommand(Parameters.CommandNameHelpCommands, new Help(), false);
        // TODO : add implementation for the commands
    }

    // domains initializer
    static {

    }

    /**
     * created and adds a system command to the lists
     * @param name the name of hte ocmmamd
     * @param baseCommand the class that implements the command
     */
    public static void addSystemCommand(String name, BaseCommand baseCommand, boolean mainCommand) {
        Command cmd = new Command(0, name, baseCommand, CommandAccess.System);
        allCommands.put(cmd.name, cmd);
        if (mainCommand)
            commandList.put(cmd.name, cmd);
    }

    /**
     * entry point for worker process
     * @param args
{'fraction_non_alphanumeric': 0.07982370225269343, 'fraction_numerical': 0.0004897159647404506, 'mean_word_length': 3.564245810055866, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '5919087', 'n_tokens_mistral': 1003, 'n_tokens_neox': 1010, 'n_words': 332}