<commit_before>package net.acomputerdog.BlazeLoader.util.config;

import net.acomputerdog.BlazeLoader.api.base.ApiBase;
import net.acomputerdog.BlazeLoader.mod.Mod;

import java.io.File;
import java.io.IOException;

/**
 * An auto-saving and auto-loading config file for mods.  Saves to the registered config directory.
 * To use ModConfig, mods should create a class that extends ModConfig and add fields to be set.
 * All fields not marked as transient will be saved and loaded.  All primitives and Strings will be
 * saved to a Properties-format file.  Make SURE that values are set in the constructor, NOT hardcoded into the class!
 * Otherwise the compiler will REMOVE the fields and convert them to constants!
 * Also be sure to call "loadSettings()" at the end of your constructor or the settings will not be loaded.
 * A sample constructor looks like this:
 *
 * public SomeModConfig(Mod owner){
 *     super(owner);
 *     valueOfSomething = 42;
 *     nameOfSomething = "some name";
 *     valueOfSomethingElse = .12345;
 *     loadSettings();
 * }
 */
public abstract class ModConfig {
    protected transient Mod owner;
    protected transient File configFile;

    /**
     * Creates a new config file using fileName as the filename.
     * @param owner The mod that created this config.
     * @param fileName The filename to use.
     */
    public ModConfig(Mod owner, String fileName){
        if(owner == null){
            throw new IllegalArgumentException("owner cannot be null!");
        }
        if(fileName == null){
            throw new IllegalArgumentException("fileName cannot be null!");
        }
        this.owner = owner;
        this.configFile = new File(ApiBase.configDir, fileName);
        if(!configFile.exists()){
            try {
                if(!(new File(configFile.getParent()).mkdirs() || new File(configFile.getName()).createNewFile())){<commit_msg>Corrected descriptions for ModConfig<commit_after>package net.acomputerdog.BlazeLoader.util.config;

import net.acomputerdog.BlazeLoader.api.base.ApiBase;
import net.acomputerdog.BlazeLoader.mod.Mod;

import java.io.File;
import java.io.IOException;

/**
 * An auto-saving and auto-loading config file for mods.  Saves to the registered config directory.
 * To use ModConfig, mods should create a class that extends ModConfig and add fields to be set.
 * All fields not marked as transient will be saved and loaded.  All primitives and Strings will be
 * saved to a Properties-format file.  Make SURE that values are set in the constructor, NOT hardcoded into the class!
 * Otherwise the compiler will REMOVE the fields and convert them to constants!
 * Also be sure to call "loadConfig()" at the end of your constructor or the settings will not be loaded.
 * A sample constructor looks like this:
 *
 * public SomeModConfig(Mod owner, String fileName){
 *     super(owner, fileName);
 *     valueOfSomething = 42;
 *     nameOfSomething = "some name";
 *     valueOfSomethingElse = .12345;
 *     loadConfig();
 * }
 */
public abstract class ModConfig {
    protected transient Mod owner;
    protected transient File configFile;

    /**
     * Creates a new config file using fileName as the filename.
     * @param owner The mod that created this config.
     * @param fileName The filename to use.
     */
    public ModConfig(Mod owner, String fileName){
        if(owner == null){
            throw new IllegalArgumentException("owner cannot be null!");
        }
        if(fileName == null){
            throw new IllegalArgumentException("fileName cannot be null!");
        }
        this.owner = owner;
        this.configFile = new File(ApiBase.configDir, fileName);
        if(!configFile.exists()){
            try {
                if(!(new File(configFile.getParent()).mkdirs() || new File(configFile.getName()).createNewFile())){
{'fraction_non_alphanumeric': 0.08783783783783784, 'fraction_numerical': 0.0036382536382536385, 'mean_word_length': 3.1700975081256773, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4666151', 'n_tokens_mistral': 1024, 'n_tokens_neox': 1004, 'n_words': 399}