<commit_before>package org.terasology.codecity.world.generator;

import java.util.ArrayList;
import java.util.List;

import org.terasology.codecity.world.loader.CodeCityDefaultLoader;
import org.terasology.codecity.world.loader.CodeCityLoader;
import org.terasology.codecity.world.loader.CodeCityLoaderManager;
import org.terasology.codecity.world.map.CodeMap;
import org.terasology.codecity.world.map.CodeMapFactory;
import org.terasology.codecity.world.map.DrawableCode;
import org.terasology.codecity.world.map.DrawableCodeFactory;
import org.terasology.codecity.world.structure.CodeRepresentation;
import org.terasology.codecity.world.structure.scale.CodeScale;
import org.terasology.codecity.world.structure.scale.SquareRootCodeScale;
import org.terasology.engine.SimpleUri;
import org.terasology.registry.CoreRegistry;
import org.terasology.world.generation.BaseFacetedWorldGenerator;
import org.terasology.world.generation.WorldBuilder;
import org.terasology.world.generator.RegisterWorldGenerator;

/**
 * Generate a new world using information provided by JEdit
 */
@RegisterWorldGenerator(id = "codecity", displayName = "CodeCity", description = "Generates the world using a CodeCity structure")
public class CodeCityWorldGenerator extends BaseFacetedWorldGenerator {
    private final CodeScale cScale = new SquareRootCodeScale();

    public CodeCityWorldGenerator(SimpleUri uri) {
        super(uri);
    }

    @Override
    public void initialize() {
        
        //Retorna en loader por fichero  en caso de que este exista, si no, el por socket.
        CodeCityLoader loader = CodeCityLoaderManager.getLoader();
        

        //CodeCityLoader loader = new CodeCityDefaultLoader();

        //CodeCityLoader loader = new CodeCitySocketLoader(25778);
        
        CodeRepresentation code = loader.loadCodeRepresentation();

        CodeMap codeMap = generateCodeMap(code);
        CoreRegistry.put(CodeMap.class, codeMap);
        CoreRegistry.put(CodeRepresentation.class, code);

        super.initialize();
        
        storeCodeRepresentation(code);
    }

    private void storeCodeRepresentation(CodeRepresentation code) {
        JEditExporter.export(code);
        <commit_msg>Change codecity world generator loader to default loader.<commit_after>package org.terasology.codecity.world.generator;

import java.util.ArrayList;
import java.util.List;

import org.terasology.codecity.world.loader.CodeCityDefaultLoader;
import org.terasology.codecity.world.loader.CodeCityLoader;
import org.terasology.codecity.world.loader.CodeCityLoaderManager;
import org.terasology.codecity.world.map.CodeMap;
import org.terasology.codecity.world.map.CodeMapFactory;
import org.terasology.codecity.world.map.DrawableCode;
import org.terasology.codecity.world.map.DrawableCodeFactory;
import org.terasology.codecity.world.structure.CodeRepresentation;
import org.terasology.codecity.world.structure.scale.CodeScale;
import org.terasology.codecity.world.structure.scale.SquareRootCodeScale;
import org.terasology.engine.SimpleUri;
import org.terasology.registry.CoreRegistry;
import org.terasology.world.generation.BaseFacetedWorldGenerator;
import org.terasology.world.generation.WorldBuilder;
import org.terasology.world.generator.RegisterWorldGenerator;

/**
 * Generate a new world using information provided by JEdit
 */
@RegisterWorldGenerator(id = "codecity", displayName = "CodeCity", description = "Generates the world using a CodeCity structure")
public class CodeCityWorldGenerator extends BaseFacetedWorldGenerator {
    private final CodeScale cScale = new SquareRootCodeScale();

    public CodeCityWorldGenerator(SimpleUri uri) {
        super(uri);
    }

    @Override
    public void initialize() {
        
        //Retorna en loader por fichero  en caso de que este exista, si no, el por socket.
        //CodeCityLoader loader = CodeCityLoaderManager.getLoader();
        

        CodeCityLoader loader = new CodeCityDefaultLoader();

        //CodeCityLoader loader = new CodeCitySocketLoader(25778);
        
        CodeRepresentation code = loader.loadCodeRepresentation();

        CodeMap codeMap = generateCodeMap(code);
        CoreRegistry.put(CodeMap.class, codeMap);
        CoreRegistry.put(CodeRepresentation.class, code);

        super.initialize();
        
        storeCodeRepresentation(code);
    }

    private void storeCodeRepresentation(CodeRepresentation code) {
        JEditExporter.export(code);
        
{'fraction_non_alphanumeric': 0.08646112600536193, 'fraction_numerical': 0.002234137622877569, 'mean_word_length': 4.348864994026284, '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': '3639407', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1226, 'n_words': 247}