FreeHEP API
Version current

org.freehep.util.argv
Class NumberOption

java.lang.Object
  extended byorg.freehep.util.argv.NumberOption
All Implemented Interfaces:
Option
Direct Known Subclasses:
DoubleOption, IntOption

public class NumberOption
extends Object
implements Option

A Number option for use with ArgumentParser. A Number option may have a default value. If specified on the command line, a Number option takes the value of the argument immediately following its flag.

Source Code:
NumberOption.java

Constructor Summary
NumberOption(String flag, String name, BigDecimal defaultValue, String description)
           
NumberOption(String flag, String name, String description)
           
NumberOption(String flag, String shortCut, String name, BigDecimal defaultValue, String description)
           
NumberOption(String flag, String shortCut, String name, String description)
           
 
Method Summary
 String getOption()
          Must return the flag and parameters of this option.
 String getUsage()
          Must return a description of the usage of this option.
 BigDecimal getValue()
          Return the value of this argument, which may be null.
 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

NumberOption

public NumberOption(String flag,
                    String name,
                    String description)

NumberOption

public NumberOption(String flag,
                    String shortCut,
                    String name,
                    String description)

NumberOption

public NumberOption(String flag,
                    String name,
                    BigDecimal defaultValue,
                    String description)

NumberOption

public NumberOption(String flag,
                    String shortCut,
                    String name,
                    BigDecimal defaultValue,
                    String description)
Method Detail

getValue

public BigDecimal getValue()
Return the value of this argument, which may be null. Returns the default value if the value was not set when the command line was parsed.


parse

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

Specified by:
parse in interface Option
Throws:
MissingArgumentException
ArgumentFormatException

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.