FreeHEP API
Version current

org.freehep.util.argv
Class PairOption

java.lang.Object
  extended byorg.freehep.util.argv.PairOption
All Implemented Interfaces:
Option

public class PairOption
extends Object
implements Option

A Pair option for use with ArgumentParser. A Pair option has two values, a source and a destination, and is useful for programs which translate (or otherwise process) some input to produce some output. Source and destination could be, for example, either file formats or file names. On the command line, a translate argument consists of a flag followed by the source and destination arguments, in that order:

   -<flag> <source> <dest>
 

Source Code:
PairOption.java

Constructor Summary
PairOption(String flag, String name1, String name2, String description)
          Initialize a new Pair argument.
PairOption(String flag, String shortCut, String name1, String name2, String description)
           
 
Method Summary
 String getDestination()
          Return the destination value of this argument, which may be null.
 String getOption()
          Must return the flag and parameters of this option.
 String getSource()
          Return the source value of this argument, which may be null.
 String getUsage()
          Must return a description of the usage of this option.
 int parse(List values)
          Parsing method invoked by ArgumentParser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PairOption

public PairOption(String flag,
                  String name1,
                  String name2,
                  String description)
Initialize a new Pair argument.


PairOption

public PairOption(String flag,
                  String shortCut,
                  String name1,
                  String name2,
                  String description)
Method Detail

getSource

public String getSource()
Return the source value of this argument, which may be null.


getDestination

public String getDestination()
Return the destination value of this argument, which may be null.


parse

public int parse(List values)
          throws MissingArgumentException
Parsing method invoked by ArgumentParser.

Specified by:
parse in interface Option
Throws:
MissingArgumentException

getOption

public String getOption()
Description copied from interface: Option
Must return the flag and parameters of this option.

Specified by:
getOption in interface Option

getUsage

public String getUsage()
Description copied from interface: Option
Must return a description of the usage of this option.

Specified by:
getUsage in interface Option

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.