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 java.lang.Object

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


Constructor Summary
ArgumentParser.Result(java.util.Map<java.lang.String,java.lang.Iterable<java.lang.String>> options, java.lang.Iterable<java.lang.String> params)
           
 
Method Summary
 Pair<java.lang.String,java.lang.String> getBinaryOption(java.lang.String opt)
          Get the 2 arguments associated with the given option, or null if it is undefined or has a different number of arguments.
 java.lang.Iterable<java.lang.String> getOption(java.lang.String opt)
          Get the arguments associated with the given option, or null if it is undefined.
 Quad<java.lang.String,java.lang.String,java.lang.String,java.lang.String> getQuaternaryOption(java.lang.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<java.lang.String,java.lang.String,java.lang.String> getTernaryOption(java.lang.String opt)
          Get the 3 arguments associated with the given option, or null if it is undefined or has a different number of arguments.
 java.lang.String getUnaryOption(java.lang.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(java.lang.String opt)
          Test whether the given option was defined with 0 arguments.
 boolean hasOption(java.lang.String opt)
          Test whether the given option was defined (or was given a default value).
 java.lang.Iterable<java.lang.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(java.util.Map<java.lang.String,java.lang.Iterable<java.lang.String>> options,
                             java.lang.Iterable<java.lang.String> params)
Method Detail

params

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


hasOption

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


getOption

public java.lang.Iterable<java.lang.String> getOption(java.lang.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(java.lang.String opt)
Test whether the given option was defined with 0 arguments.

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

getUnaryOption

public java.lang.String getUnaryOption(java.lang.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<java.lang.String,java.lang.String> getBinaryOption(java.lang.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<java.lang.String,java.lang.String,java.lang.String> getTernaryOption(java.lang.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<java.lang.String,java.lang.String,java.lang.String,java.lang.String> getQuaternaryOption(java.lang.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.