<commit_before>package org.perfidix.visitor;

import java.io.File;
import java.io.FileWriter;

import org.perfidix.IResult;
import org.perfidix.Result;

/**
 * Storing the raw data without any computation in single files. Per method, one
 * single file is opened with the data. Only usable with Benchmarkresult
 * 
 * @author sebi
 * 
 */
public class RawData extends ResultVisitor {

    private final File folder;

    public RawData(final String pathToFolder) {
        folder = new File(pathToFolder);
        if (folder.exists()) {
            if (!folder.isDirectory()) {
                folder.delete();
            } else {
                deleteRecursive(folder);
            }
        }
        folder.mkdir();
    }

    @Override
    public void visit(Result r) {
        if (!(r instanceof IResult.BenchmarkResult)) {
            throw new RuntimeException("only benchmark results are supported!");
        }
        IResult.BenchmarkResult benchRes = (IResult.BenchmarkResult) r;
        for (IResult.ClassResult classRes : benchRes.getChildren()) {
            for (IResult.MethodResult methodRes : classRes.getChildren()) {
                getMethodResult(methodRes);
            }
        }
    }

    private void getMethodResult(final IResult.MethodResult methodRes) {
        try {
            int j = 1;
            File currentFile = new File(this.folder.getAbsolutePath() + "//"
                    + methodRes.getName() + j);
            while (currentFile.exists()) {
                System.out.println(currentFile.getAbsolutePath()
                        + " is already existing!");
                j++;
                currentFile = new File(this.folder.getAbsolutePath() + "//"
                        + methodRes.getName() + j);

            }
            System.out.println("Using " + currentFile.getAbsolutePath()<commit_msg>using file speparator instead of simple slash..HAIL TO WINDOWS!<commit_after>package org.perfidix.visitor;

import java.io.File;
import java.io.FileWriter;

import org.perfidix.IResult;
import org.perfidix.Result;

/**
 * Storing the raw data without any computation in single files. Per method, one
 * single file is opened with the data. Only usable with Benchmarkresult
 * 
 * @author sebi
 * 
 */
public class RawData extends ResultVisitor {

    private final File folder;

    public RawData(final String pathToFolder) {
        folder = new File(pathToFolder);
        if (folder.exists()) {
            if (!folder.isDirectory()) {
                folder.delete();
            } else {
                deleteRecursive(folder);
            }
        }
        folder.mkdir();
    }

    @Override
    public void visit(Result r) {
        if (!(r instanceof IResult.BenchmarkResult)) {
            throw new RuntimeException("only benchmark results are supported!");
        }
        IResult.BenchmarkResult benchRes = (IResult.BenchmarkResult) r;
        for (IResult.ClassResult classRes : benchRes.getChildren()) {
            for (IResult.MethodResult methodRes : classRes.getChildren()) {
                getMethodResult(methodRes);
            }
        }
    }

    private void getMethodResult(final IResult.MethodResult methodRes) {
        try {
            File currentFile = new File(this.folder.getAbsolutePath()
                    + File.separatorChar + methodRes.getName());
            while (currentFile.exists()) {
                System.out.println(currentFile.getAbsolutePath()
                        + " is already existing!");
                currentFile = new File(this.folder.getAbsolutePath()
                        + File.separatorChar + methodRes.getName());
            }
            System.out.println("Using " + currentFile.getAbsolutePath()
{'fraction_non_alphanumeric': 0.09895694035838459, 'fraction_numerical': 0.0002674511901577962, 'mean_word_length': 2.053061224489796, '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': '351425', 'n_tokens_mistral': 994, 'n_tokens_neox': 951, 'n_words': 239}