/*
 * @(#)Option.java
 *
 * Copyright (c) 2002-2003 JSCAPE
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JSCAPE. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JSCAPE.
 */

package com.jscape.util.cli;

import com.jscape.util.ListIterator;

/**
 * A command line option abstraction.
 * Takes responsibility for concrete arguments parsing.
 *
 * @author Alex
 */
public interface Option
        extends Comparable {

    /**
     * Represents "any" position in command line.
     */
    int ANY_POSITION = Integer.MAX_VALUE;

    /**
     * Returns option name.
     *
     * @return option name
     */
    String getName();

    /**
     * Checks if the option is required.
     *
     * @return <code>true</code> if option is required;
     *         <code>false</code> otherwise
     */
    boolean isRequired();

    /**
     * Returns required option position in command line.
     *
     * @return option position in command line
     */
    int getPosition();

    /**
     * Parses the command line and returns option argument.
     *
     * @param i iterator
     *
     * @return String instance
     */
    String parse(ListIterator<Argument> i);

}
