<commit_before>package hudson.util.jna;

import java.util.regex.Pattern;
import java.util.regex.Matcher;

/**
 * .NET related code.
 * 
 * @author <NAME>
 */
public class DotNet {
    /**
     * Returns true if the .NET framework of the given version (or greater) is installed.
     */
    public static boolean isInstalled(int major, int minor) {
        // see http://support.microsoft.com/?scid=kb;en-us;315291 for the basic algorithm
        // observation in my registry shows that the actual key name can be things like "v2.0 SP1"
        // or "v2.0.50727", so the regexp is written to accomodate this.
        RegistryKey key = RegistryKey.LOCAL_MACHINE.openReadonly("SOFTWARE\\Microsoft\\.NETFramework");
        for( String keyName : key.getSubKeys() ) {
            Matcher m = VERSION_PATTERN.matcher(keyName);
            if(m.matches()) {
                int mj = Integer.parseInt(m.group(1));
                if(mj>=major) {
                    int mn = Integer.parseInt(m.group(2));
                    if(mn>=minor)
                        return true;
                }
            }
        }
        return false;
    }

    private static final Pattern VERSION_PATTERN = Pattern.compile("v(\\d+)\\.(\\d+).*");
}<commit_msg>early disposal for better GC<commit_after>package hudson.util.jna;

import java.util.regex.Pattern;
import java.util.regex.Matcher;

/**
 * .NET related code.
 * 
 * @author <NAME>
 */
public class DotNet {
    /**
     * Returns true if the .NET framework of the given version (or greater) is installed.
     */
    public static boolean isInstalled(int major, int minor) {
        // see http://support.microsoft.com/?scid=kb;en-us;315291 for the basic algorithm
        // observation in my registry shows that the actual key name can be things like "v2.0 SP1"
        // or "v2.0.50727", so the regexp is written to accomodate this.
        RegistryKey key = RegistryKey.LOCAL_MACHINE.openReadonly("SOFTWARE\\Microsoft\\.NETFramework");
        try {
            for( String keyName : key.getSubKeys() ) {
                Matcher m = VERSION_PATTERN.matcher(keyName);
                if(m.matches()) {
                    int mj = Integer.parseInt(m.group(1));
                    if(mj>=major) {
                        int mn = Integer.parseInt(m.group(2));
                        if(mn>=minor)
                            return true;
                    }
                }
            }
            return false;
        } finally {
            key.dispose();
        }
    }

    private static final Pattern VERSION_PATTERN = Pattern.compile("v(\\d+)\\.(\\d+).*");
}
{'fraction_non_alphanumeric': 0.11975591151792525, 'fraction_numerical': 0.013729977116704805, 'mean_word_length': 1.8234660925726587, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '5442541', 'n_tokens_mistral': 797, 'n_tokens_neox': 747, 'n_words': 199}