<commit_before>package com.aol.advertising.vulcan.rolling;

import static java.lang.Math.max;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

import com.aol.advertising.vulcan.rolling.RollingCondition.FileAwareRollingCondition;

/**
 * Accessing the disk to check the file size is a costly operation. This class uses a simple pseudo-
 * <a href="https://en.wikipedia.org/wiki/PID_controller">PID controller</a> to try to predict
 * rolling points while minimizing the number of reads from disk
 * 
 * @author <NAME>
 *
 */
class SizeBasedRollingCondition implements FileAwareRollingCondition {

  private static final int ONE_MB_IN_BYTES = 1_048_576;

  private final long rolloverTriggeringSizeInBytes;

  private Path avroFilename;
  private RollingCondition loadedImplementation;

  SizeBasedRollingCondition(int rolloverTriggeringSizeInMb) {
    this.rolloverTriggeringSizeInBytes = rolloverTriggeringSizeInMb * ONE_MB_IN_BYTES;
  }

  @Override
  public void registerAvroFileName(Path avroFilename) {<commit_msg>Fixed Sonar violation<commit_after>package com.aol.advertising.vulcan.rolling;

import static java.lang.Math.max;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

import com.aol.advertising.vulcan.rolling.RollingCondition.FileAwareRollingCondition;

/**
 * Accessing the disk to check the file size is a costly operation. This class uses a simple pseudo-
 * <a href="https://en.wikipedia.org/wiki/PID_controller">PID controller</a> to try to predict
 * rolling points while minimizing the number of reads from disk
 * 
 * @author <NAME>
 *
 */
class SizeBasedRollingCondition implements FileAwareRollingCondition {

  private static final long ONE_MB_IN_BYTES = 1_048_576L;

  private final long rolloverTriggeringSizeInBytes;

  private Path avroFilename;
  private RollingCondition loadedImplementation;

  SizeBasedRollingCondition(int rolloverTriggeringSizeInMb) {
    this.rolloverTriggeringSizeInBytes = rolloverTriggeringSizeInMb * ONE_MB_IN_BYTES;
  }

  @Override
  public void registerAvroFileName(Path avroFilename) {
{'fraction_non_alphanumeric': 0.07459867799811143, 'fraction_numerical': 0.0066100094428706326, 'mean_word_length': 5.401812688821752, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '3439724', 'n_tokens_mistral': 659, 'n_tokens_neox': 618, 'n_words': 162}