edu.rice.cs.plt.text
Class ArgumentParser.Result

java.lang.Object
  extended by edu.rice.cs.plt.text.ArgumentParser.Result
Enclosing class:
ArgumentParser

public static class ArgumentParser.Result
extends Object

A collection of the options and parameters parsed from an array of arguments.


Constructor Summary
ArgumentParser.Result(Map<String,Iterable<String>> options, Iterable<String> params)
           
 
Method Summary
 Pair<String,String> getBinaryOption(String opt)
          Get the 2 arguments associated with the given option, or null if it is undefined or has a different number of arguments.
 Iterable<String> getOption(String opt)
          Get the arguments associated with the given option, or null if it is undefined.
 Quad<String,String,String,String> getQuaternaryOption(String opt)
          Get the 4 arguments associated with the given option, or null if it is undefined or has a different number of arguments.
 Triple<String,String,String> getTernaryOption(String opt)
          Get the 3 arguments associated with the given option, or null if it is undefined or has a different number of arguments.
 String getUnaryOption(String opt)
          Get the single argument associated with the given option, or null if it is undefined or has a different number of arguments.
 boolean hasNullaryOption(String opt)
          Test whether the given option was defined with 0 arguments.
 boolean hasOption(String opt)
          Test whether the given option was defined (or was given a default value).
 Iterable<String> params()
          Get the parameters (non-option strings associated with no option) that were parsed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArgumentParser.Result

public ArgumentParser.Result(Map<String,Iterable<String>> options,
                             Iterable<String> params)
Method Detail

params

public Iterable<String> params()
Get the parameters (non-option strings associated with no option) that were parsed.


hasOption

public boolean hasOption(String opt)
Test whether the given option was defined (or was given a default value).


getOption

public Iterable<String> getOption(String opt)
Get the arguments associated with the given option, or null if it is undefined.

Parameters:
opt - The option name, excluding the "-" prefix.

hasNullaryOption

public boolean hasNullaryOption(String opt)
Test whether the given option was defined with 0 arguments.

Parameters:
opt - The option name, excluding the "-" prefix.

getUnaryOption

public String getUnaryOption(String opt)
Get the single argument associated with the given option, or null if it is undefined or has a different number of arguments.

Parameters:
opt - The option name, excluding the "-" prefix.

getBinaryOption

public Pair<String,String> getBinaryOption(String opt)
Get the 2 arguments associated with the given option, or null if it is undefined or has a different number of arguments.

Parameters:
opt - The option name, excluding the "-" prefix.

getTernaryOption

public Triple<String,String,String> getTernaryOption(String opt)
Get the 3 arguments associated with the given option, or null if it is undefined or has a different number of arguments.

Parameters:
opt - The option name, excluding the "-" prefix.

getQuaternaryOption

public Quad<String,String,String,String> getQuaternaryOption(String opt)
Get the 4 arguments associated with the given option, or null if it is undefined or has a different number of arguments.

Parameters:
opt - The option name, excluding the "-" prefix.