<commit_before>package com.sefford.kor.repositories.utils;

import com.sefford.kor.repositories.interfaces.CacheFolder;

import java.io.File;

/**
 * Default implementation of a cache folder.
 * <p>
 * Provides a basic implementation on how a folder should provide files to the {@link com.sefford.kor.repositories.DiskJsonDataSource DataSource}
 * or the {@link FileTimeExpirationPolicy}
 *
 * @author <NAME> <<EMAIL>>
 */
public abstract class CacheFolderImpl<K> implements CacheFolder<K> {

    /**
     * File which honors the folder the instance is representing
     */
    final File root;

    /**
     * Creates a new instance of CacheFolder.
     * <p>
     * The creation of the directory will be attempted.
     *
     * @param root Path of the folder, it will be wrapped
     */
    public CacheFolderImpl(String root) {
        this(new File(root));
    }

    /**
     * Creates a new instance of CacheFolder.
     * <p>
     * The creation of the directory will be attempted.
     *
     * @param root File pointing to the folder.
     */
    public CacheFolderImpl(File root) {
        if (root == null) {
            throw new NullPointerException("root cannot be null");
        }
        this.root = root;
        if (root != null && !this.root.exists()) {
            this.root.mkdirs();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public File[] files() {
        return root.listFiles();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean exists() {
        return root != null && root.exists();
    }
}<commit_msg>Changed visibility of root so it can be acessed by inheritors<commit_after>package com.sefford.kor.repositories.utils;

import com.sefford.kor.repositories.interfaces.CacheFolder;

import java.io.File;

/**
 * Default implementation of a cache folder.
 * <p>
 * Provides a basic implementation on how a folder should provide files to the {@link com.sefford.kor.repositories.DiskJsonDataSource DataSource}
 * or the {@link FileTimeExpirationPolicy}
 *
 * @author <NAME> <<EMAIL>>
 */
public abstract class CacheFolderImpl<K> implements CacheFolder<K> {

    /**
     * File which honors the folder the instance is representing
     */
    protected final File root;

    /**
     * Creates a new instance of CacheFolder.
     * <p>
     * The creation of the directory will be attempted.
     *
     * @param root Path of the folder, it will be wrapped
     */
    public CacheFolderImpl(String root) {
        this(new File(root));
    }

    /**
     * Creates a new instance of CacheFolder.
     * <p>
     * The creation of the directory will be attempted.
     *
     * @param root File pointing to the folder.
     */
    public CacheFolderImpl(File root) {
        if (root == null) {
            throw new NullPointerException("root cannot be null");
        }
        this.root = root;
        if (root != null && !this.root.exists()) {
            this.root.mkdirs();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public File[] files() {
        return root.listFiles();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean exists() {
        return root != null && root.exists();
    }
}
{'fraction_non_alphanumeric': 0.11124845488257108, 'fraction_numerical': 0.0, 'mean_word_length': 2.276315789473684, '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': '20406', 'n_tokens_mistral': 931, 'n_tokens_neox': 915, 'n_words': 295}