<commit_before>package org.hihan.girinoscope;

import java.io.File;
import java.lang.reflect.Field;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class Native {

    private static final Logger logger = Logger.getLogger(Native.class.getName());

    public enum OS {

        Linux("linux"), MacOSX("mac"), Windows("win");

        String[] names;

        OS(String... names) {
            this.names = names;
        }

        public static OS resolve(String osName) {
            for (OS os : values()) {
                for (String name : os.names) {
                    if (osName.toLowerCase().contains(name)) {
                        return os;
                    }
                }
            }
            return null;
        }
    }

    public static void setLibraryPath() {
        String osName = System.getProperty("os.name");
        OS os = OS.resolve(osName);
        if (os != null) {
            boolean is64bits = "64".equals(System.getProperty("sun.arch.data.model").toLowerCase());

            String nativePath = System.getProperty("girinoscope.native.path");
            if (nativePath == null) {
                nativePath = "native";
            }
            logger.log(Level.INFO, "Native path is '{0}'.", nativePath);

            File libPath = new File(nativePath);
            libPath = new File(libPath, os.name().toLowerCase());
            libPath = new File(libPath, is64bits ? "lib64" : "lib");

            if (libPath.exists()) {
                /*
                 * http://blog.cedarsoft.com/2010/11/setting-java-library-path-<commit_msg>Small refactoring.<commit_after>package org.hihan.girinoscope;

import java.io.File;
import java.lang.reflect.Field;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class Native {

    private static final Logger logger = Logger.getLogger(Native.class.getName());

    public enum OS {

        Linux("linux"), MacOSX("mac"), Windows("win");

        String[] names;

        OS(String... names) {
            this.names = names;
        }

        public static OS resolve(String osName) {
            for (OS os : values()) {
                for (String name : os.names) {
                    if (osName.toLowerCase().contains(name)) {
                        return os;
                    }
                }
            }
            return null;
        }
    }

    public static void setLibraryPath() {
        String osName = System.getProperty("os.name");
        OS os = OS.resolve(osName);
        if (os != null) {
            boolean is64bits = "64".equals(System.getProperty("sun.arch.data.model"));

            String nativePath = System.getProperty("girinoscope.native.path");
            if (nativePath == null) {
                nativePath = "native";
            }
            logger.log(Level.INFO, "Native path is '{0}'.", nativePath);

            File libPath = new File(nativePath);
            libPath = new File(libPath, os.name().toLowerCase());
            libPath = new File(libPath, is64bits ? "lib64" : "lib");

            if (libPath.exists()) {
                /*
                 * http://blog.cedarsoft.com/2010/11/setting-java-library-path-
{'fraction_non_alphanumeric': 0.12651492757907182, 'fraction_numerical': 0.008867868755542418, 'mean_word_length': 1.8389261744966443, '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': '5921213', 'n_tokens_mistral': 956, 'n_tokens_neox': 923, 'n_words': 202}