Package jargs.gnu

Examples of jargs.gnu.CmdLineParser$OptionException


            if (wString.equalsIgnoreCase("tf")) {
              weight = new TF();
            } else if (wString.equalsIgnoreCase("tfidf")) {
              weight = new TFIDF();
            } else {
              throw new OptionException(weightOpt);
            }
          } else {
            weight = new TFIDF();
          }
          String field = cmdLine.getValue(fieldOpt).toString();
View Full Code Here


      testOutputDirectory = new Path((String) cmdLine.getValue(testOutputDirOpt));
    
      charset = Charset.forName((String) cmdLine.getValue(charsetOpt));

      if (cmdLine.hasOption(testSplitSizeOpt) && cmdLine.hasOption(testSplitPctOpt)) {
        throw new OptionException(testSplitSizeOpt, "must have either split size or split percentage option, not BOTH");
      } else if (!cmdLine.hasOption(testSplitSizeOpt) && !cmdLine.hasOption(testSplitPctOpt)) {
        throw new OptionException(testSplitSizeOpt, "must have either split size or split percentage option");
      }

      if (cmdLine.hasOption(testSplitSizeOpt)) {
        setTestSplitSize(Integer.parseInt((String) cmdLine.getValue(testSplitSizeOpt)));
      }
View Full Code Here

          if ("tf".equalsIgnoreCase(wString)) {
            weight = new TF();
          } else if ("tfidf".equalsIgnoreCase(wString)) {
            weight = new TFIDF();
          } else {
            throw new OptionException(weightOpt);
          }
        } else {
          weight = new TFIDF();
        }
View Full Code Here

          if ("text".equals(dictionaryType)) {
            dictionary = VectorHelper.loadTermDictionary(new File(cmdLine.getValue(dictOpt).toString()));
          } else if ("sequencefile".equals(dictionaryType)) {
            dictionary = VectorHelper.loadTermDictionary(conf, cmdLine.getValue(dictOpt).toString());
          } else {
            throw new OptionException(dictTypeOpt);
          }
        }
        boolean useCSV = cmdLine.hasOption(csvOpt);

        boolean sizeOnly = cmdLine.hasOption(sizeOpt);
View Full Code Here

        if ("tf".equalsIgnoreCase(wString)) {
          processIdf = false;
        } else if ("tfidf".equalsIgnoreCase(wString)) {
          processIdf = true;
        } else {
          throw new OptionException(weightOpt);
        }
      } else {
        processIdf = true;
      }
     
View Full Code Here

                        final ListIterator arguments)
        throws OptionException {
        final String arg = (String) arguments.next();

        if (!canProcess(commandLine, arg)) {
            throw new OptionException(this, ResourceConstants.UNEXPECTED_TOKEN, arg);
        }

        final int propertyStart = optionString.length();
        final int equalsIndex = arg.indexOf('=', propertyStart);
        final String property;
View Full Code Here

                    commandLine.addValue(option, token);
                    arguments.add(token);
                }

                if (values.hasMoreTokens()) {
                    throw new OptionException(option, ResourceConstants.ARGUMENT_UNEXPECTED_VALUE,
                                              values.nextToken());
                }
            }
            // it must be a value as it is
            else {
View Full Code Here

                         final Option option)
        throws OptionException {
        final List values = commandLine.getValues(option);

        if (values.size() < minimum) {
            throw new OptionException(option, ResourceConstants.ARGUMENT_MISSING_VALUES);
        }

        if (values.size() > maximum) {
            throw new OptionException(option, ResourceConstants.ARGUMENT_UNEXPECTED_VALUE,
                                      (String) values.get(maximum));
        }

        if (validator != null) {
            try {
                validator.validate(values);
            } catch (InvalidArgumentException ive) {
                throw new OptionException(option, ResourceConstants.ARGUMENT_UNEXPECTED_VALUE,
                                          ive.getMessage());
            }
        }
    }
View Full Code Here

            if (arg.startsWith(disabledPrefix)) {
                commandLine.addSwitch(this, false);
                arguments.set(disabledPrefix + preferredName);
            }
        } else {
            throw new OptionException(this, ResourceConstants.UNEXPECTED_TOKEN, arg);
        }
    }
View Full Code Here

    }

    public void validate(WriteableCommandLine commandLine)
        throws OptionException {
        if (isRequired() && !commandLine.hasOption(this)) {
            throw new OptionException(this, ResourceConstants.OPTION_MISSING_REQUIRED,
                                      getPreferredName());
        }

        super.validate(commandLine);
    }
View Full Code Here

TOP

Related Classes of jargs.gnu.CmdLineParser$OptionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.