Cytoscape 2.8.0 API

org.apache.commons.cli
Class Parser

java.lang.Object
  extended by org.apache.commons.cli.Parser
All Implemented Interfaces:
CommandLineParser
Direct Known Subclasses:
BasicParser, GnuParser, PosixParser

public abstract class Parser
extends Object
implements CommandLineParser

Parser creates CommandLines.

Version:
$Revision: 155404 $
Author:
John Keyes (john at integralsource.com)
See Also:
Parser

Constructor Summary
Parser()
           
 
Method Summary
protected abstract  String[] flatten(Options opts, String[] arguments, boolean stopAtNonOption)
          Subclasses must implement this method to reduce the arguments that have been passed to the parse method.
 CommandLine parse(Options options, String[] arguments)
          Parses the specified arguments based on the specifed Options.
 CommandLine parse(Options options, String[] arguments, boolean stopAtNonOption)
          Parses the specified arguments based on the specifed Options.
 CommandLine parse(Options options, String[] arguments, Properties properties)
          Parse the arguments according to the specified options and properties.
 CommandLine parse(Options options, String[] arguments, Properties properties, boolean stopAtNonOption)
          Parse the arguments according to the specified options and properties.
 void processArgs(Option opt, ListIterator iter)
          Process the argument values for the specified Option opt using the values retrieved from the specified iterator iter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser()
Method Detail

flatten

protected abstract String[] flatten(Options opts,
                                    String[] arguments,
                                    boolean stopAtNonOption)

Subclasses must implement this method to reduce the arguments that have been passed to the parse method.

Parameters:
opts - The Options to parse the arguments by.
arguments - The arguments that have to be flattened.
stopAtNonOption - specifies whether to stop flattening when a non option has been encountered
Returns:
a String array of the flattened arguments

parse

public CommandLine parse(Options options,
                         String[] arguments)
                  throws ParseException

Parses the specified arguments based on the specifed Options.

Specified by:
parse in interface CommandLineParser
Parameters:
options - the Options
arguments - the arguments
Returns:
the CommandLine
Throws:
ParseException - if an error occurs when parsing the arguments.

parse

public CommandLine parse(Options options,
                         String[] arguments,
                         Properties properties)
                  throws ParseException
Parse the arguments according to the specified options and properties.

Specified by:
parse in interface CommandLineParser
Parameters:
options - the specified Options
arguments - the command line arguments
properties - command line option name-value pairs
Returns:
the list of atomic option and value tokens
Throws:
ParseException - if there are any problems encountered while parsing the command line tokens.

parse

public CommandLine parse(Options options,
                         String[] arguments,
                         boolean stopAtNonOption)
                  throws ParseException

Parses the specified arguments based on the specifed Options.

Specified by:
parse in interface CommandLineParser
Parameters:
options - the Options
arguments - the arguments
stopAtNonOption - specifies whether to stop interpreting the arguments when a non option has been encountered and to add them to the CommandLines args list.
Returns:
the CommandLine
Throws:
ParseException - if an error occurs when parsing the arguments.

parse

public CommandLine parse(Options options,
                         String[] arguments,
                         Properties properties,
                         boolean stopAtNonOption)
                  throws ParseException
Parse the arguments according to the specified options and properties.

Specified by:
parse in interface CommandLineParser
Parameters:
options - the specified Options
arguments - the command line arguments
properties - command line option name-value pairs
stopAtNonOption - stop parsing the arguments when the first non option is encountered.
Returns:
the list of atomic option and value tokens
Throws:
ParseException - if there are any problems encountered while parsing the command line tokens.

processArgs

public void processArgs(Option opt,
                        ListIterator iter)
                 throws ParseException

Process the argument values for the specified Option opt using the values retrieved from the specified iterator iter.

Parameters:
opt - The current Option
iter - The iterator over the flattened command line Options.
Throws:
ParseException - if an argument value is required and it is has not been found.

Cytoscape 2.8.0 API

Copyright 2010 Cytoscape Consortium. All rights reserved.