Example usage for org.apache.commons.cli2 CommandLine getValue

List of usage examples for org.apache.commons.cli2 CommandLine getValue

Introduction

In this page you can find the example usage for org.apache.commons.cli2 CommandLine getValue.

Prototype

Object getValue(final Option option) throws IllegalStateException;

Source Link

Document

Retrieves the single Argument value associated with the specified Option

Usage

From source file:com.martinkampjensen.thesis.Main.java

private static void check(CommandLine cmdLine) {
    final String fileName = (String) cmdLine.getValue(_oCheck);
    final File file = new File(fileName);

    Application.check(file);//from  w  w  w .j  ava  2 s  .c  o  m
}

From source file:com.martinkampjensen.thesis.Main.java

private static void execute(CommandLine cmdLine) {
    final String fileName = (String) cmdLine.getValue(_oExecute);
    final File file = new File(fileName);

    Application.execute(file);// w w  w .ja v  a  2s .c o m
}

From source file:com.martinkampjensen.thesis.Main.java

private static void evaluate(CommandLine cmdLine) {
    final String fileOrClassName = (String) cmdLine.getValue(_oEvaluate);
    final Model model = Util.instantiateModel(fileOrClassName);

    Application.evaluate(model);//from  w  ww.j a va  2s . co  m
}

From source file:com.martinkampjensen.thesis.Main.java

private static void print(CommandLine cmdLine) {
    final String fileOrClassName = (String) cmdLine.getValue(_oPrint);
    final Model model = Util.instantiateModel(fileOrClassName);

    Application.print(model);/*from ww  w.  j a v a 2 s. c o  m*/
}

From source file:com.martinkampjensen.thesis.Main.java

private static void visualize(CommandLine cmdLine) {
    final String fileOrClassName = (String) cmdLine.getValue(_oVisualize);
    final Model model = Util.instantiateModel(fileOrClassName);

    Application.visualize(model);//w w  w . j a  v  a  2 s .c o  m
}

From source file:com.martinkampjensen.thesis.Main.java

private static void minimize(CommandLine cmdLine) {
    final String fileOrClassName = (String) cmdLine.getValue(_oMinimize);
    final Model model = Util.instantiateModel(fileOrClassName);
    final boolean random = cmdLine.hasOption(_oMinimizeRandom);

    Application.minimize(model, random);
}

From source file:com.martinkampjensen.thesis.Main.java

private static void analyze(CommandLine cmdLine) {
    final String fileOrClassName = (String) cmdLine.getValue(_oAnalyze);
    final Model model = Util.instantiateModel(fileOrClassName);
    final String output = (String) cmdLine.getValue(_oAnalyzeOutput);
    final File file = (output == null ? null : new File(output));

    Application.analyze(model, file);//from   w  w w  .  j av  a  2 s.  co  m
}

From source file:com.martinkampjensen.thesis.Main.java

private static void sample(CommandLine cmdLine) {
    final String fileOrClassName = (String) cmdLine.getValue(_oSample);
    final Model model = Util.instantiateModel(fileOrClassName);
    final int[] angleIds = parseIntArray(cmdLine, _oSampleAngleIds);
    final boolean random = cmdLine.hasOption(_oSampleRandom);

    Application.sample(model, angleIds, random);
}

From source file:com.martinkampjensen.thesis.Main.java

private static void extract(CommandLine cmdLine) {
    final String fileName = (String) cmdLine.getValue(_oExtract);
    final int[] conformationIds = parseIntArray(cmdLine, _oExtractConformation);
    final String trajectory = (String) cmdLine.getValue(_oExtractTrajectory);

    final File trajectoryFile = (trajectory == null ? null : new File(trajectory));

    if (trajectoryFile != null) {
        if (conformationIds.length != 2) {
            errorExit("Specify exactly two ids", StatusCode.ARGUMENT);
        }/* w  w w  . ja v  a2  s .co m*/

        Application.extract(new File(fileName), conformationIds[0], conformationIds[1], trajectoryFile);
    } else {
        Application.extract(new File(fileName), conformationIds);
    }
}

From source file:com.martinkampjensen.thesis.Main.java

private static void barriers(CommandLine cmdLine) {
    final String fileOrClassName = (String) cmdLine.getValue(_oBarriers);
    final String postScript = (String) cmdLine.getValue(_oBarriersPostScript);
    final String structure = (String) cmdLine.getValue(_oBarriersStructure);
    final File moleculeFile = new File(fileOrClassName);
    final File postScriptFile = (postScript == null ? null : new File(postScript));
    final File structureFile = (structure == null ? null : new File(structure));

    if (cmdLine.hasOption(_oBarriersTrajectory)) {
        final String trajectory = (String) cmdLine.getValue(_oBarriersTrajectory);
        final String energy = (String) cmdLine.getValue(_oBarriersEnergy);
        final File trajectoryFile = new File(trajectory);
        final File energyFile = new File(energy);
        final double pruning = parseDouble(cmdLine, _oBarriersPruning);
        final double neighbor = parseDouble(cmdLine, _oBarriersNeighbor);
        Application.barriers(moleculeFile, trajectoryFile, energyFile, postScriptFile, structureFile, pruning,
                neighbor);//from  w w w.  j a  v a2  s  .co m
    } else {
        final String topology = (String) cmdLine.getValue(_oBarriersTopology);
        final File topologyFile = (topology == null ? null : new File(topology));
        final Model model = Util.instantiateModel(fileOrClassName, topologyFile);
        Application.barriers(moleculeFile, model, postScriptFile, structureFile);
    }
}