Adds missing comments for the converter argument class and adds a shorthand parameter
This commit is contained in:
		@@ -1,20 +1,60 @@
 | 
			
		||||
package net.knarcraft.ffmpegconverter.parser;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A class representing an argument
 | 
			
		||||
 * A class representing a command argument
 | 
			
		||||
 */
 | 
			
		||||
public class ConverterArgument {
 | 
			
		||||
 | 
			
		||||
    private final String name;
 | 
			
		||||
    private final char shorthand;
 | 
			
		||||
    private final boolean valueRequired;
 | 
			
		||||
    private final ConverterArgumentValue valueType;
 | 
			
		||||
 | 
			
		||||
    public ConverterArgument(String name, boolean valueRequired, ConverterArgumentValue valueType) {
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a converter argument
 | 
			
		||||
     * @param name <p>The name of the argument which users has to type.</p>
 | 
			
		||||
     * @param shorthand <p>A single character value for using the command.</p>
 | 
			
		||||
     * @param valueRequired <p>Whether the argument must be followed by a valid value.</p>
 | 
			
		||||
     * @param valueType <p>The type of value the argument requires.</p>
 | 
			
		||||
     */
 | 
			
		||||
    public ConverterArgument(String name, char shorthand, boolean valueRequired, ConverterArgumentValue valueType) {
 | 
			
		||||
        this.name = name;
 | 
			
		||||
        this.shorthand = shorthand;
 | 
			
		||||
        this.valueRequired = valueRequired;
 | 
			
		||||
        this.valueType = valueType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private boolean testArgumentValue(String value) {
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the argument name
 | 
			
		||||
     * @return <p>The argument name.</p>
 | 
			
		||||
     */
 | 
			
		||||
    public String getName() {
 | 
			
		||||
        return name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the argument shorthand
 | 
			
		||||
     * @return <p>The argument shorthand</p>
 | 
			
		||||
     */
 | 
			
		||||
    public char getShorthand() {
 | 
			
		||||
        return shorthand;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets whether the argument requires a value
 | 
			
		||||
     * @return <p>Whether the argument requires a value.</p>
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isValueRequired() {
 | 
			
		||||
        return valueRequired;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Tests whether the given value is valid for this converter argument
 | 
			
		||||
     *
 | 
			
		||||
     * @param value <p>The value to test.</p>
 | 
			
		||||
     * @return <p>True if the argument is valid. False otherwise.</p>
 | 
			
		||||
     */
 | 
			
		||||
    public boolean testArgumentValue(String value) {
 | 
			
		||||
        if (value.length() == 0) {
 | 
			
		||||
            return !valueRequired;
 | 
			
		||||
        }
 | 
			
		||||
@@ -26,9 +66,9 @@ public class ConverterArgument {
 | 
			
		||||
                String lower = value.toLowerCase();
 | 
			
		||||
                return lower.equals("true") || lower.equals("false");
 | 
			
		||||
            case COMMA_SEPARATED_LIST:
 | 
			
		||||
                return !value.contains(" ");
 | 
			
		||||
            case SINGLE_VALUE:
 | 
			
		||||
                return !value.contains(" ");
 | 
			
		||||
                return true;
 | 
			
		||||
            case STRING:
 | 
			
		||||
                return true;
 | 
			
		||||
            case INT:
 | 
			
		||||
                int ignored = Integer.parseInt(value);
 | 
			
		||||
                return true;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user