<commit_before>package org.cirdles.topsoil.app.file;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.prefs.Preferences;

/**
 * Utility methods for setting/retrieving a list of most recently used files.
 */
public final class RecentFiles {

    //**********************************************//
    //                  CONSTANTS                   //
    //**********************************************//

    private static final String RECENT_FILES = "recent-files";
    private static final int MAX_SIZE = 10;

    //**********************************************//
    //                 CONSTRUCTORS                 //
    //**********************************************//

    private RecentFiles() {
        // Prevents instantiation by default constructor
    }

    //**********************************************//
    //                PUBLIC METHODS                //
    //**********************************************//

    /**
     * Returns an array containing the most recent project file paths.
     *
     * @return  Path[]
     */
    public static Path[] getProjectPaths() {
        return loadRecentFiles().toArray(new Path[]{});
    }

    /**
     * Adds a path to the list of most recent project files.
     *
     * @param path  project file Path
     */
    public static void addProjectPath(Path path) {
        List<Path> paths = loadRecentFiles();
        paths.remove(path);
        if (paths.size() == MAX_SIZE) {
            paths.remove(MAX_SIZE - 1);
        }
        paths.add(0, path);
        saveRecentFiles(paths);
    }

    /**
     * Clears the list of most recent files.
     */
    public static void clearProjectPaths() {
        Preferences prefs = Preferences.userNodeForPackage(RecentFiles.class);
        for (int i = 1; i <= MAX_SIZE; i++) {
            prefs.remove(RECENT_FILES + i);
        }
    }

    /**
     * Returns the path of the directory containing the most recently used project files.
     * @return Path
     */
    public static Path findMRUProjectFolder() {
        Path path;
        Path[] recentlyUsed = getProjectPaths();
        if (recentlyUsed.length == 0) {<commit_msg>added new methods and documenatation to RecentFiles<commit_after>package org.cirdles.topsoil.app.file;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.prefs.Preferences;

/**
 * Utility methods for setting/retrieving a list of most recently used files.
 */
public final class RecentFiles {

    //**********************************************//
    //                  CONSTANTS                   //
    //**********************************************//

    private static final String RECENT_FILES = "recent-files";
    private static final int MAX_SIZE = 10;

    //**********************************************//
    //                 CONSTRUCTORS                 //
    //**********************************************//

    private RecentFiles() {
        // Prevents instantiation by default constructor
    }

    //**********************************************//
    //                PUBLIC METHODS                //
    //**********************************************//

    /**
     * Returns an array containing the most recent project file paths.
     *
     * @return  Path[]
     */
    public static Path[] getProjectPaths() {
        return loadRecentFiles().toArray(new Path[]{});
    }

    /**
     * Adds a path to the list of most recent project files.
     *
     * @param path  project file Path
     */
    public static void addProjectPath(Path path) {
        List<Path> paths = loadRecentFiles();
        paths.remove(path);
        if (paths.size() == MAX_SIZE) {
            paths.remove(MAX_SIZE - 1);
        }
        paths.add(0, path);
        saveRecentFiles(paths);
    }

    /**
     * Clears the list of most recent files.
     */
    public static void clearProjectPaths() {
        Preferences prefs = Preferences.userNodeForPackage(RecentFiles.class);
        for (int i = 1; i <= MAX_SIZE; i++) {
            prefs.remove(RECENT_FILES + i);
        }
    }

    /**
     * Returns an array containing the most recently exported table paths.
     *
     * @return Path[]
     */
    public static Path[] getExportPaths() { return null;}

    /**
     * Adds a path to the list of most recently exported table paths.
     *
     * @param path table path
     */
    public static void addExportPath(Path path) { return;}

    /**
     * Clears the list of most recently exported table paths.
     */
    public static void clearExportPaths() { return;}

    /**
     * Returns the path of the directory containing the most recently used project files.
     * @return Path
     */
    public static Path findMRUProjectFolder() {
        Path path;
        Path[] recentlyUsed = getProjectPaths();
        if (recentlyUsed.length == 0) {
{'fraction_non_alphanumeric': 0.20641282565130262, 'fraction_numerical': 0.002404809619238477, 'mean_word_length': 2.1891373801916933, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '5630138', 'n_tokens_mistral': 1312, 'n_tokens_neox': 1238, 'n_words': 364}