home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 September / maximum-cd-2009-09.iso / DiscContents / digsby_setup.exe / lib / plugins / researchdriver / res / process.jar / jargs / gnu / CmdLineParser$Option$DoubleOption.class (.txt) < prev    next >
Encoding:
Java Class File  |  2005-04-09  |  1.5 KB  |  26 lines

  1. package jargs.gnu;
  2.  
  3. import java.text.NumberFormat;
  4. import java.text.ParseException;
  5. import java.util.Locale;
  6.  
  7. public class CmdLineParser$Option$DoubleOption extends CmdLineParser.Option {
  8.    public CmdLineParser$Option$DoubleOption(char shortForm, String longForm) {
  9.       super(shortForm, longForm, true);
  10.    }
  11.  
  12.    public CmdLineParser$Option$DoubleOption(String longForm) {
  13.       super(longForm, true);
  14.    }
  15.  
  16.    protected Object parseValue(String arg, Locale locale) throws CmdLineParser.IllegalOptionValueException {
  17.       try {
  18.          NumberFormat format = NumberFormat.getNumberInstance(locale);
  19.          Number num = format.parse(arg);
  20.          return new Double(num.doubleValue());
  21.       } catch (ParseException var5) {
  22.          throw new CmdLineParser.IllegalOptionValueException(this, arg);
  23.       }
  24.    }
  25. }
  26.