<commit_before>package com.codemonkeylabs.fpslibrary;

import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
//TODO: Clean this shit up, ugh is not a variable name :-)
//todo word....agreed....will do... :)
public class Calculation
{
    public enum Metric {GOOD, BAD, MEDIUM};

    public static List<Integer> getDroppedSet(FPSConfig fpsConfig, List<Long> dataSet)
    {
        List<Integer> droppedSet = new ArrayList<>();
        long start = -1;
        for (Long value : dataSet) {
            if (start == -1) {
                start = value;
                continue;
            }

            long diffNs = value - start;
            start = value;
            long diffMs = TimeUnit.MILLISECONDS.convert(diffNs, TimeUnit.NANOSECONDS);
            long dev = Math.round(fpsConfig.deviceRefreshRateInMs);
            if (diffMs > dev) {
                long ugh = (diffMs / dev);//(long)fpsConfig.deviceRefreshRateInMs);
                droppedSet.add((int)ugh);
            }
        }
        return droppedSet;
    }

    public static AbstractMap.SimpleEntry<Metric, Long> calculateMetric(FPSConfig fpsConfig, List<Long> dataSet, List<Integer> droppedSet) {
        Metric metric = Metric.GOOD;

        long realSampleLengthNs = dataSet.get(dataSet.size()-1) - dataSet.get(0);
        long realSampleLengthMs = TimeUnit.MILLISECONDS.convert(realSampleLengthNs, TimeUnit.NANOSECONDS);
        long size = (long) realSampleLengthMs/(long) fpsConfig.deviceRefreshRateInMs;

        //metric<commit_msg>Update Calculation.java<commit_after>package com.codemonkeylabs.fpslibrary;

import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
public class Calculation
{
    public enum Metric {GOOD, BAD, MEDIUM};

    public static List<Integer> getDroppedSet(FPSConfig fpsConfig, List<Long> dataSet)
    {
        List<Integer> droppedSet = new ArrayList<>();
        long start = -1;
        for (Long value : dataSet) {
            if (start == -1) {
                start = value;
                continue;
            }

            long diffNs = value - start;
            start = value;
            long diffMs = TimeUnit.MILLISECONDS.convert(diffNs, TimeUnit.NANOSECONDS);
            long dev = Math.round(fpsConfig.deviceRefreshRateInMs);
            if (diffMs > dev) {
                
                long droppedCount = (diffMs / dev);
                droppedSet.add((int) droppedCount);
            }
        }
        return droppedSet;
    }

    public static AbstractMap.SimpleEntry<Metric, Long> calculateMetric(FPSConfig fpsConfig, List<Long> dataSet, List<Integer> droppedSet) {
        Metric metric = Metric.GOOD;

        long realSampleLengthNs = dataSet.get(dataSet.size()-1) - dataSet.get(0);
        long realSampleLengthMs = TimeUnit.MILLISECONDS.convert(realSampleLengthNs, TimeUnit.NANOSECONDS);
        long size = (long) realSampleLengthMs/(long) fpsConfig.deviceRefreshRateInMs;

        //metric
{'fraction_non_alphanumeric': 0.10316682990532158, 'fraction_numerical': 0.002611818478615736, 'mean_word_length': 2.4120267260579062, 'pattern_counts': {'":': 0, '<': 17, '<?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': 1, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6744404', 'n_tokens_mistral': 927, 'n_tokens_neox': 898, 'n_words': 201}