<commit_before>
/*
 * Carrot2 project.
 *
 * Copyright (C) 2002-2007, <NAME>, <NAME>.
 * Portions (C) Contributors listed in "carrot2.CONTRIBUTORS" file.
 * All rights reserved.
 *
 * Refer to the full license file "carrot2.LICENSE"
 * in the root folder of the repository checkout or at:
 * http://www.carrot2.org/carrot2.LICENSE
 */

package org.carrot2.launcher;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;

/**
 * Launch options for {@link Launcher}.
 * 
 * @author <NAME>
 */
final class LaunchOptions
{
    /**
     * A list of {@link URL}s to classpath locations.
     */
    private final ArrayList urls = new ArrayList();
    
    /**
     * Fully qualified name of the class to launch.
     */
    private String className;
    
    /**
     * Arguments to be passed to the launched class.
     */
    private String [] classArgs;

    /**
     * 
     */
    public void setClassName(String className)
    {
        this.className = className;
    }

    /**
     * 
     */
    public String getClassName()
    {
        return className;
    }

    /**
     * 
     */
    public void setClassArgs(String [] classArgs)
    {
        this.classArgs = classArgs;
    }
    
    /**
     * 
     */
    public String [] getClassArgs()
    {
        return classArgs;
    }
    
    /**
     * Adds a single JAR location to classpath.
     */
    public void addJarLocation(File jarLocation)
    {
        try
        {
            this.urls.add(jarLocation.toURL());
        }
        catch (MalformedURLException e)
        {
            throw new LaunchException("Could not create an URL to: " + jarLocation);
        }
    }

    /**
     * Adds a classpath directory (top folder of packages structure).
     */
    public void addDirLocation(File dirLocation)
    {
        try
        {
            final URL url = dirLocation.toURL();
            final String external = url.toExternalForm();
            if (!external.endsWith("/")) {
                throw new LaunchException("A folder URL should end with a '/'.");
            }
            this.urls.add(url);
        }
        catch (MalformedURLException e)
        {
            throw new LaunchException("Could not create an URL to: " + dirLocation);
        }
    }

    /**
     * @return Returns a list of {@link URL}s to classpath locations.
     */
    public URL [] getClasspathURLs()
    {
        final URL [] urls = (URL []) this.urls.toArray(new URL [this.urls.size()]);
        return urls;
    }
}<commit_msg>Minor deprecation fix for JDK1.6 (compatible with 1.4+).<commit_after>
/*
 * Carrot2 project.
 *
 * Copyright (C) 2002-2007, <NAME>, <NAME>.
 * Portions (C) Contributors listed in "carrot2.CONTRIBUTORS" file.
 * All rights reserved.
 *
 * Refer to the full license file "carrot2.LICENSE"
 * in the root folder of the repository checkout or at:
 * http://www.carrot2.org/carrot2.LICENSE
 */

package org.carrot2.launcher;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;

/**
 * Launch options for {@link Launcher}.
 * 
 * @author <NAME>
 */
final class LaunchOptions
{
    /**
     * A list of {@link URL}s to classpath locations.
     */
    private final ArrayList urls = new ArrayList();
    
    /**
     * Fully qualified name of the class to launch.
     */
    private String className;
    
    /**
     * Arguments to be passed to the launched class.
     */
    private String [] classArgs;

    /**
     * 
     */
    public void setClassName(String className)
    {
        this.className = className;
    }

    /**
     * 
     */
    public String getClassName()
    {
        return className;
    }

    /**
     * 
     */
    public void setClassArgs(String [] classArgs)
    {
        this.classArgs = classArgs;
    }
    
    /**
     * 
     */
    public String [] getClassArgs()
    {
        return classArgs;
    }
    
    /**
     * Adds a single JAR location to classpath.
     */
    public void addJarLocation(File jarLocation)
    {
        try
        {
            this.urls.add(jarLocation.toURL());
        }
        catch (MalformedURLException e)
        {
            throw new LaunchException("Could not create an URL to: " + jarLocation);
        }
    }

    /**
     * Adds a classpath directory (top folder of packages structure).
     */
    public void addDirLocation(File dirLocation)
    {
        try
        {
            final URL url = dirLocation.toURI().toURL();
            final String external = url.toExternalForm();
            if (!external.endsWith("/")) {
                throw new LaunchException("A folder URL should end with a '/'.");
            }
            this.urls.add(url);
        }
        catch (MalformedURLException e)
        {
            throw new LaunchException("Could not create an URL to: " + dirLocation);
        }
    }

    /**
     * @return Returns a list of {@link URL}s to classpath locations.
     */
    public URL [] getClasspathURLs()
    {
        final URL [] urls = (URL []) this.urls.toArray(new URL [this.urls.size()]);
        return urls;
    }
}
{'fraction_non_alphanumeric': 0.11386042915136285, 'fraction_numerical': 0.006185965590566402, 'mean_word_length': 1.8397365532381997, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6964010', 'n_tokens_mistral': 1553, 'n_tokens_neox': 1504, 'n_words': 421}