<commit_before>/*
 * Copyright 2012 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Eclipse Public License version 1.0, available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.jboss.aesh.cl.internal;

import org.jboss.aesh.cl.exception.OptionParserException;
import org.jboss.aesh.console.Config;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 */
public class ParameterInt {

    private String name;
    private String usage;

   private Class<?> argumentType;
    private List<OptionInt> options;

    public ParameterInt(String name, String usage) {
        setName(name);
        setUsage(usage);
        options = new ArrayList<OptionInt>();
    }

    public ParameterInt(String name, String usage, Class<?> argumentType) {
        setName(name);
        setUsage(usage);
        setArgumentType(argumentType);
        options = new ArrayList<OptionInt>();
    }

    public ParameterInt(String name, String usage,
                        Class<?> argumentType, OptionInt[] options) throws OptionParserException {
        setName(name);
        setUsage(usage);
        setArgumentType(argumentType);
        this.options = new ArrayList<OptionInt>();
        setOptions(Arrays.asList(options));
    }

    public ParameterInt(String name, String usage,
                        Class<?> argumentType, List<OptionInt> options) throws OptionParserException {
        setName(name);
        setUsage(usage);
        setArgumentType(argumentType);
        this.options = new ArrayList<OptionInt>();
        setOptions(options);
    }

    public List<OptionInt> getOptions() {
        return options;
    }

    public void addOption(OptionInt option) {
        options.add(option);
    }

    /**
     * Add an option
     * Name or longName can be null
     * Both argument and type can be null
     *
     * @param name name (short) one char
     * @param longName multi character name
     * @param description a description of the option
     * @param hasValue if this option has value
     * @param argument what kind of argument this option can have
     * @param required is it required?
     * @param valueSeparator separator char
     * @param isProperty is it a property
     * @param hasMultipleValues have it multiple values
     * @param type what kind of type it is (not used)
     */
    public void addOption(char name, String longName, String description, boolean hasValue,
                     String argument, boolean required, char valueSeparator, boolean isProperty,
                     boolean hasMultipleValues, Class<?> type) throws OptionParserException {
        options.add(new OptionInt(verifyThatNamesAreUnique(name, longName), longName, description,
                hasValue, argument, required, valueSeparator, isProperty, hasMultipleValues, type));
    }

    /**
     * Add an option
     * Name or longName can be null
     * Both argument and type can be null
     *
     * @param name name (short) one char
     * @param longName multi character name
     * @param description a description of the option
     * @param hasValue if this option has value
     * @param argument what kind of argument this option can have
     * @param required is it required?
     * @param type what kind of type it is (not used)
     */
    public void addOption(char name, String longName, String description, boolean hasValue,
                     String argument, boolean required, boolean hasMultipleValues, Class<?> type) throws OptionParserException {
        options.add(new OptionInt(verifyThatNamesAreUnique(name, longName), longName, description,
                hasValue, argument, required, '\u0000', false, hasMultipleValues, type));
    }

    /**
     * Add an option
     * Name or longName can be null
     *
     * @param name name (short) one char
     * @param longName multi character name
     * @param description a description of the option
     * @param hasValue if this option has value
     */
    public void addOption(char name, String longName, String description, boolean hasValue) throws OptionParserException {
        addOption(verifyThatNamesAreUnique(name, longName), longName, description, hasValue, null, false, false, null);
    }

    private void setOptions(List<OptionInt> options) throws OptionParserException {
        for(OptionInt opt : options) {
            this.options.add(new OptionInt(verifyThatNamesAreUnique(opt.getName(), opt.getLongName()), opt.getLongName(),
                    opt.getDescription(), opt.hasValue(), opt.getArgument(), opt.isRequired(), opt.getValueSeparator(),
                    opt.isProperty(), opt.hasMultipleValues() , opt.getType()));
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUsage() {<commit_msg>make sure to verify the name and longNames<commit_after>/*
 * Copyright 2012 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Eclipse Public License version 1.0, available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.jboss.aesh.cl.internal;

import org.jboss.aesh.cl.exception.OptionParserException;
import org.jboss.aesh.console.Config;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 */
public class ParameterInt {

    private String name;
    private String usage;

   private Class<?> argumentType;
    private List<OptionInt> options;

    public ParameterInt(String name, String usage) {
        setName(name);
        setUsage(usage);
        options = new ArrayList<OptionInt>();
    }

    public ParameterInt(String name, String usage, Class<?> argumentType) {
        setName(name);
        setUsage(usage);
        setArgumentType(argumentType);
        options = new ArrayList<OptionInt>();
    }

    public ParameterInt(String name, String usage,
                        Class<?> argumentType, OptionInt[] options) throws OptionParserException {
        setName(name);
        setUsage(usage);
        setArgumentType(argumentType);
        this.options = new ArrayList<OptionInt>();
        setOptions(Arrays.asList(options));
    }

    public ParameterInt(String name, String usage,
                        Class<?> argumentType, List<OptionInt> options) throws OptionParserException {
        setName(name);
        setUsage(usage);
        setArgumentType(argumentType);
        this.options = new ArrayList<OptionInt>();
        setOptions(options);
    }

    public List<OptionInt> getOptions() {
        return options;
    }

    public void addOption(OptionInt opt) throws OptionParserException {
        this.options.add(new OptionInt(verifyThatNamesAreUnique(opt.getName(), opt.getLongName()), opt.getLongName(),
                opt.getDescription(), opt.hasValue(), opt.getArgument(), opt.isRequired(), opt.getValueSeparator(),
                opt.isProperty(), opt.hasMultipleValues() , opt.getType()));
    }

    /**
     * Add an option
     * Name or longName can be null
     * Both argument and type can be null
     *
     * @param name name (short) one char
     * @param longName multi character name
     * @param description a description of the option
     * @param hasValue if this option has value
     * @param argument what kind of argument this option can have
     * @param required is it required?
     * @param valueSeparator separator char
     * @param isProperty is it a property
     * @param hasMultipleValues have it multiple values
     * @param type what kind of type it is (not used)
     */
    public void addOption(char name, String longName, String description, boolean hasValue,
                     String argument, boolean required, char valueSeparator, boolean isProperty,
                     boolean hasMultipleValues, Class<?> type) throws OptionParserException {
        options.add(new OptionInt(verifyThatNamesAreUnique(name, longName), longName, description,
                hasValue, argument, required, valueSeparator, isProperty, hasMultipleValues, type));
    }

    /**
     * Add an option
     * Name or longName can be null
     * Both argument and type can be null
     *
     * @param name name (short) one char
     * @param longName multi character name
     * @param description a description of the option
     * @param hasValue if this option has value
     * @param argument what kind of argument this option can have
     * @param required is it required?
     * @param type what kind of type it is (not used)
     */
    public void addOption(char name, String longName, String description, boolean hasValue,
                     String argument, boolean required, boolean hasMultipleValues, Class<?> type) throws OptionParserException {
        options.add(new OptionInt(verifyThatNamesAreUnique(name, longName), longName, description,
                hasValue, argument, required, '\u0000', false, hasMultipleValues, type));
    }

    /**
     * Add an option
     * Name or longName can be null
     *
     * @param name name (short) one char
     * @param longName multi character name
     * @param description a description of the option
     * @param hasValue if this option has value
     */
    public void addOption(char name, String longName, String description, boolean hasValue) throws OptionParserException {
        addOption(verifyThatNamesAreUnique(name, longName), longName, description, hasValue, null, false, false, null);
    }

    private void setOptions(List<OptionInt> options) throws OptionParserException {
        for(OptionInt opt : options) {
            this.options.add(new OptionInt(verifyThatNamesAreUnique(opt.getName(), opt.getLongName()), opt.getLongName(),
                    opt.getDescription(), opt.hasValue(), opt.getArgument(), opt.isRequired(), opt.getValueSeparator(),
                    opt.isProperty(), opt.hasMultipleValues(), opt.getType()));
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUsage() {
{'fraction_non_alphanumeric': 0.09252738654147105, 'fraction_numerical': 0.002347417840375587, 'mean_word_length': 2.842540398346486, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, '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': '6200109', 'n_tokens_mistral': 2655, 'n_tokens_neox': 2604, 'n_words': 870}