<commit_before>package ch.silviowangler.map4j.mapstruct;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiFunction;

/**
 * Created by <NAME> on 16/04/16.
 */
public final class MapperRegistry
{

   private Map<CombinedClassKey, BiFunction> mappers = new HashMap<> ();

   public void addMapping (Class aClass, Class bClass, BiFunction function)
   {
      mappers.put (new CombinedClassKey (aClass, bClass), function);
   }

   public <T> BiFunction resolveConsumer(Class<?> sourceClass, Class<T> targetClass) {

       NoSuchMappingException ex = new NoSuchMappingException("No such mapping for source class " + sourceClass.getSimpleName() + " and target class " + targetClass.getSimpleName(), sourceClass, targetClass);

        BiFunction c =  Optional.of(mappers.get(new CombinedClassKey(sourceClass, targetClass)))
                .orElseThrow(() -> ex);

        return c;
    }
   private static class CombinedClassKey
   {

      private Class a;
      private Class b;

      public CombinedClassKey (Class a, Class b)
      {
         this.a = a;
         this.b = b;
      }

      @Override
      public boolean equals (Object o)
      {
         if (this == o) return true;
         if (!(o instanceof CombinedClassKey)) return false;
         CombinedClassKey that = (CombinedClassKey) o;
         return Objects.equals (a, that.a) && Objects.equals (b, that.b);
      }

      @Override
      public int hashCode ()
      {
         return Objects.hash (a, b);
      }
   }
}
<commit_msg>Formattings<commit_after>package ch.silviowangler.map4j.mapstruct;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiFunction;

/**
 * Created by <NAME> on 16/04/16.
 */
public final class MapperRegistry
{

   private Map<CombinedClassKey, BiFunction> mappers = new HashMap<> ();

   public void addMapping (Class aClass, Class bClass, BiFunction function)
   {
      mappers.put (new CombinedClassKey (aClass, bClass), function);
   }

   public <T> BiFunction resolveConsumer (Class<?> sourceClass, Class<T> targetClass)
   {

      NoSuchMappingException ex = new NoSuchMappingException ("No such mapping for source class " + sourceClass.getSimpleName () + " and target class " + targetClass.getSimpleName (),
                                                              sourceClass,
                                                              targetClass);

      BiFunction c = Optional.of (mappers.get (new CombinedClassKey (sourceClass, targetClass))).orElseThrow ( () -> ex);

      return c;
   }
   private static class CombinedClassKey
   {

      private Class a;
      private Class b;

      public CombinedClassKey (Class a, Class b)
      {
         this.a = a;
         this.b = b;
      }

      @Override
      public boolean equals (Object o)
      {
         if (this == o) return true;
         if (!(o instanceof CombinedClassKey)) return false;
         CombinedClassKey that = (CombinedClassKey) o;
         return Objects.equals (a, that.a) && Objects.equals (b, that.b);
      }

      @Override
      public int hashCode ()
      {
         return Objects.hash (a, b);
      }
   }
}

{'fraction_non_alphanumeric': 0.10182926829268292, 'fraction_numerical': 0.00426829268292683, 'mean_word_length': 2.4, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7492413', 'n_tokens_mistral': 961, 'n_tokens_neox': 917, 'n_words': 264}