Java 类org.apache.commons.cli.AlreadySelectedException 实例源码

项目:BNPMix.java    文件:MixtureOptionPack.java   
@Override
public MixtureOptionPack extract(CommandLine cmdline) throws AlreadySelectedException {
  NumEmptyClusters = Integer.parseInt(cmdline.getOptionValue("NumEmptyClusters", defaultNumEmptyClusters));
  if (cmdline.hasOption("Reuse")) {
    alg.setSelected(reuse);
  } else if (cmdline.hasOption("Neal8")) {
    alg.setSelected(neal8);
  } else if (cmdline.hasOption("Slice")) {
    alg.setSelected(slice);
  } else {
    throw new Error("mixture algorithm option not set");
  }
  if (cmdline.hasOption("Marginalized")) {
    marg.setSelected(marginalized);
  } else if (cmdline.hasOption("Sampled")) {
    marg.setSelected(sampled);
  }

  //MaxEmptyClusters = Integer.parseInt(cmdline.getOptionValue("MaxEmptyClusters", defaultMaxEmptyClusters));
  return this;
}
项目:build-management    文件:CMnCmdLineTool.java   
/**
 * Parse the command line arguments.
 */
protected static CommandLine parseArgs(String[] args) {
    CommandLine cl = null;
    try {
        cl = argParser.parse(cmdOptions, args);
    } catch (AlreadySelectedException dupex) {
        displayHelp();
        display("\nDuplicate option: " + dupex.getMessage());
    } catch (MissingOptionException opex) {
        displayHelp();
        display("\nMissing command line option: " + opex.getMessage());
    } catch (UnrecognizedOptionException uex) {
        displayHelp();
        display(uex.getMessage());
    } catch (ParseException pe) {
        display("Unable to parse the command line arguments: " + pe);
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    return cl;
}
项目:vcloud-client    文件:Configuration.java   
public static CommandLine parseCli(ModeType mode, String[] args) {
    CommandLine cli = null;
    Options opt = ConfigModes.getMode(mode);
    try {
        cli = new IgnorePosixParser(true).parse(opt, args);
    } catch (MissingArgumentException me) {
        Formatter.usageError(me.getLocalizedMessage(), mode);
        System.exit(-1);
    } catch (MissingOptionException mo) {
        Formatter.usageError(mo.getLocalizedMessage(), mode);
        System.exit(-1);
    } catch (AlreadySelectedException ase) {
        Formatter.usageError(ase.getLocalizedMessage(), mode);
    } catch (UnrecognizedOptionException uoe) {
        Formatter.usageError(uoe.getLocalizedMessage(), mode);
    } catch (ParseException e) {
        Formatter.printStackTrace(e);
        System.exit(-1);
    }

    return cli;
}
项目:systemml    文件:CLIOptionsParserTest.java   
@Test(expected = AlreadySelectedException.class)
public void testBadClean() throws Exception {
  String cl = "systemml -clean -f test.dml";
  String[] args = cl.split(" ");
  Options options = DMLScript.createCLIOptions();
  DMLScript.parseCLArguments(args, options);
}
项目:systemml    文件:CLIOptionsParserTest.java   
@Test(expected = AlreadySelectedException.class)
public void testBadScript() throws Exception {
  String cl = "systemml -f test.dml -s \"print('hello')\"";
  String[] args = cl.split(" ");
  Options options = DMLScript.createCLIOptions();
  DMLScript.parseCLArguments(args, options);
}
项目:systemml    文件:CLIOptionsParserTest.java   
@Test(expected = AlreadySelectedException.class)
public void testBadHelp() throws Exception {
  String cl = "systemml -help -clean";
  String[] args = cl.split(" ");
  Options options = DMLScript.createCLIOptions();
  DMLScript.DMLOptions o = DMLScript.parseCLArguments(args, options);
  Assert.assertEquals(true, o.help);
}
项目:evosuite    文件:DependencyLibrary.java   
public void foo(){
    //here, at compile time we use the one in EvoSuite dependency, but not at runtime
    AlreadySelectedException e = new AlreadySelectedException(null);
    if(e.toString().equals("foo")){
        System.out.println("Only executed if SUT version is used, and not the one in EvoSuite's dependencies");
    }
}