<commit_before>package de.mycrobase.ssim.ed.helper;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AppState;

import de.mycrobase.ssim.ed.GameMode;
import de.mycrobase.ssim.ed.GameModeListener;
import de.mycrobase.ssim.ed.SSimApplication;
import de.mycrobase.ssim.ed.mission.Mission;
import de.mycrobase.ssim.ed.settings.SettingsManager;

public abstract class SteppedSSimApplication extends SimpleApplication implements SSimApplication {
    
    private Thread caller;
    
    private ScheduledExecutorService executor;
    
    protected GameMode currentMode = GameMode.Running;
    protected List<GameModeListener> gameModeListeners = new ArrayList<GameModeListener>();
    
    public SteppedSSimApplication() {
        super(new AppState[0]);
        caller = Thread.currentThread();
    }
    
    @Override
    public void simpleInitApp() {
        executor = Executors.newScheduledThreadPool(2);
    }
    
    @Override
    public void simpleUpdate(float tpf) {
        super.simpleUpdate(tpf);
        
        pause();
    }

    @Override
    public void destroy() {
        super.destroy();
        
        // shutdown all (non daemon) worker pool threads
        executor.shutdown();
    }

    @Override
    public ScheduledExecutorService getExecutor() {
        return executor;
    }
    
    @Override
    public SettingsManager getSettingsManager() {
        throw new UnsupportedOperationException();
    }
    
    @Override
    public float getSpeed() {
        return speed;
    }
    
    @Override
    public void setSpeed(float speed) {
        throw new UnsupportedOperationException();
    }
    
    @Override
    public GameMode getCurrentMode() {
        return currentMode;<commit_msg>Allow retrieval of a SettingsManager from SteppedSSimApplication for tests<commit_after>package de.mycrobase.ssim.ed.helper;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AppState;

import de.mycrobase.ssim.ed.GameMode;
import de.mycrobase.ssim.ed.GameModeListener;
import de.mycrobase.ssim.ed.Main;
import de.mycrobase.ssim.ed.SSimApplication;
import de.mycrobase.ssim.ed.mission.Mission;
import de.mycrobase.ssim.ed.settings.LayeredSettingsManager;
import de.mycrobase.ssim.ed.settings.PropertiesLayer;
import de.mycrobase.ssim.ed.settings.SettingsManager;

public abstract class SteppedSSimApplication extends SimpleApplication implements SSimApplication {
    
    private Thread caller;
    
    private LayeredSettingsManager settingsManager;
    private ScheduledExecutorService executor;
    
    protected GameMode currentMode = GameMode.Running;
    protected List<GameModeListener> gameModeListeners = new ArrayList<GameModeListener>();
    
    public SteppedSSimApplication() {
        super(new AppState[0]);
        
        caller = Thread.currentThread();
        
        settingsManager = new LayeredSettingsManager();
        settingsManager.addLayer(PropertiesLayer.fromStream(Main.class.getResourceAsStream("default.properties")));
    }
    
    @Override
    public void simpleInitApp() {
        executor = Executors.newScheduledThreadPool(2);
    }
    
    @Override
    public void simpleUpdate(float tpf) {
        super.simpleUpdate(tpf);
        
        pause();
    }

    @Override
    public void destroy() {
        super.destroy();
        
        // shutdown all (non daemon) worker pool threads
        executor.shutdown();
    }

    @Override
    public ScheduledExecutorService getExecutor() {
        return executor;
    }
    
    @Override
    public SettingsManager getSettingsManager() {
        return settingsManager;
    }
    
    @Override
    public float getSpeed() {
        return speed;
    }
    
    @Override
    public void setSpeed(float speed) {
        throw new UnsupportedOperationException();
    }
    
    @Override
    public GameMode getCurrentMode() {
        return currentMode;
{'fraction_non_alphanumeric': 0.08327385201046872, 'fraction_numerical': 0.0019034023316678564, 'mean_word_length': 3.0540019286403086, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '676438', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1170, 'n_words': 243}