<commit_before>package com.github.jfmonkeys.services.common;

import com.google.inject.AbstractModule;
import com.google.inject.name.Names;
import io.vertx.core.Vertx;
import io.vertx.ext.web.Router;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * Created by monkey on 31/05/16.
 */
public class BaseGuiceModule extends AbstractModule {
    private final ServiceModule module;

    public BaseGuiceModule(ServiceModule module){
        this.module = module;
    }

    @Override
    protected void configure() {

        ServiceVehicle serviceVehicle = new ServiceVehicle(80);
        bind(ServiceVehicle.class).toInstance(serviceVehicle);
        Vertx vertx = Vertx.vertx();
        bind(Router.class).toInstance(Router.router(vertx));
        bind(Vertx.class).toInstance(vertx);

        Map<Class, Class>  interfaceMapping = new HashMap<>();
        Set<Class> concrete = new HashSet<>();
        module.addSingletonBeans(interfaceMapping, concrete);

        for (Class clazz : interfaceMapping.keySet()){
            bind(clazz).to(interfaceMapping.get(clazz)).asEagerSingleton();
        }

        for (Class clazz : concrete){
            bind(clazz).asEagerSingleton();
        }

        interfaceMapping.clear();
        concrete.clear();

        module.addPrototypeBeans(interfaceMapping, concrete);

        for (Class clazz : interfaceMapping.keySet()){
            bind(clazz).to(interfaceMapping.get(clazz));
        }<commit_msg>listen on $PORT<commit_after>package com.github.jfmonkeys.services.common;

import com.google.inject.AbstractModule;
import com.google.inject.name.Names;
import io.vertx.core.Vertx;
import io.vertx.ext.web.Router;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * Created by monkey on 31/05/16.
 */
public class BaseGuiceModule extends AbstractModule {
    private final ServiceModule module;

    public BaseGuiceModule(ServiceModule module){
        this.module = module;
    }

    @Override
    protected void configure() {

        String port = System.getenv("PORT");
        int portI = 8080;
        if (port != null){
            portI = Integer.parseInt(port);
        }
        ServiceVehicle serviceVehicle = new ServiceVehicle(portI);
        bind(ServiceVehicle.class).toInstance(serviceVehicle);
        Vertx vertx = Vertx.vertx();
        bind(Router.class).toInstance(Router.router(vertx));
        bind(Vertx.class).toInstance(vertx);

        Map<Class, Class>  interfaceMapping = new HashMap<>();
        Set<Class> concrete = new HashSet<>();
        module.addSingletonBeans(interfaceMapping, concrete);

        for (Class clazz : interfaceMapping.keySet()){
            bind(clazz).to(interfaceMapping.get(clazz)).asEagerSingleton();
        }

        for (Class clazz : concrete){
            bind(clazz).asEagerSingleton();
        }

        interfaceMapping.clear();
        concrete.clear();

        module.addPrototypeBeans(interfaceMapping, concrete);

        for (Class clazz : interfaceMapping.keySet()){
            bind(clazz).to(interfaceMapping.get(clazz));
        }
{'fraction_non_alphanumeric': 0.11770274534553486, 'fraction_numerical': 0.005680025244556642, 'mean_word_length': 2.9974779319041613, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '5400544', 'n_tokens_mistral': 930, 'n_tokens_neox': 913, 'n_words': 175}